Category "c++"

How to create a simple version of std::function class

Suppose that I want to create a simple version ofstd::function, which has following behaviors: 1. function(){} -> A void constructor 2. function(_ReturnType,

How to link SFML-audio project with mingw64

I get an error message when I try to compile an SFML-audio project with mingw64 in C++. I've done a lot of research but I can't figure out how to fix this error

OpenCV C++ Sorting a vector of contour point in decending order

I'm trying to sort vector of contours point in decending order but whenever I used: sort(contours.begin(), contours.end() , greater<>()), It is poping

Why is this while loop returning this random values?

Although I'll explain, here is the exercise detailed. So what the code is supposed to do is grab a double and apply a fixed tax to it then display the total amo

gRPC / C++ - How to store server streaming RPC's stream for later use

What I want to achieve is to basically initiate messages from the server to the client. So basically my idea is I get the client to firstly trigger unary call w

how to store additional data in a text file apart from it's content - C++

I am doing this small university project, where I have to create a console-based text editor with some features, and making files password protected is one of t

I want to use a UAV in a pixel shader to read the data in the buffer with the CPU

I would like to have information on the number of vertices that have been increased by doing Tessellation. To do this, we send the vertex information from the D

Boost Beast async_write() With Queue

I have the following code: std::queue< nlohmann::json > outgoingMessages; void session::do_write( void ) { if ( outgoingMessages.size() > 0 ) {

opencv tutorial problem with samples::findFile()

when I'm trying to run this tutorial I'm getting this problem on samples::findFile() I tried to #include <opencv2/core/utility.hpp> but same problem, any

error: (-215:Assertion failed) (int)_numAxes == inputs[0].size() in function 'getMemoryShapes'

im trying to use opencv to do face recognition using facenet512. i converted the model to onnx format using tf2onnx. i know that the input of the model should b

Compiling a JNI file with c++ postgresql in command prompt getting fatal error

Command executed: g++ -I"C:\Program Files\Java\jdk-16.0.2\include" -I"C:\Program Files\Java\jdk-16.0.2\include\win32" -I"C:\Program Files\libpqxx\include\pqxx"

STL parallel execution vs. OpenMP performance

I'm starting a new project and would like to parallelize some computations. I've used OpenMP in the past, but am aware that now many STL algorithms can be paral

`make_unique_for_overwrite` still initializes `std::pair` elements

I was hoping that auto myPairs = make_unique_for_overwrite<pair<uint64_t, void*>[]>(arraySize); would give me uninitialized memory for my pairs. I

Build specific modules in Qt6 (i.e. QtMqtt)

For a project which uses MQTT, I always had to compile the QtMqtt module from source, because it wasn't included in the prebuilt windows release and couldn't be

How to copy char array of a structure into another char array of a structure?

#include <iostream> using namespace std; struct stud { char name[10]; int id; }; int input(stud a[], int size) { for(int i=1; i<=size; i+

Distirbute Candy - Finding minimum reproducible example of the problem

The question is to distribute candies to N children.Each child has a rating. Distribution should be such that each child have at least one candy and children wi

i have an assignment that works in compiler but does not work properly in assignment website

I have a homework that requires me to do operations on a string, I used an iterator in the second function to find the last index of a letter in the string and

gRPC / C++- How to leave server streaming rpc on

Hello I have this code: Status ListFeatures(ServerContext* context, const Rectangle* rectangle, ServerWriter<Feature>* writer) overrid

Coursera DSA Algorithmic toolbox week 4 2nd question- Partitioning Souvenirs

Problem Statement- You and two of your friends have just returned back home after visiting various countries. Now you would like to evenly split all the souveni

Unnamed union member has non-trivial operator

I am working on a project started back to 1980s, my mission is to substitute the primitive double with the Dummy class I create. The following is the simplified