This script #include <iostream> #include <unordered_map> #include <any> using namespace std; int main() { unordered_map<int, any> t
In C++, can I cast a class or some data to a void*, then to a char* to serialize it? If so, how would I de-serialize? I don't really care about portability. cla
I'm trying to link-in the AWS C++ SDK for my CMake C++ Project. However, I'm only going to be using a subset of the SDK modules (lambda) and I don't want FetchC
After struggling with C++ typedef and define, I've tried myself some code and here it is: #include <iostream> #include <string> #d
My assignment: You are given a non-negative integer variable $Z$. There are two actions available that can change its value: if $Z$ is odd, subtract 1
I want to change the variables declared in the main function using signal handler when an user defined signal is sent to the process. I do not want to use any g
C++ has std::nextafter(), which returns the next representable value after a given floating-point value f. In my case, I'd like to allow for n bits of slop in t
So I have read a lot of things about people saying const & is always good as it eliminates copying, and passing by value is a bad idea. Th
I'm now building a Voxel game. In the beginning, I use a texture atlas that stores all voxel textures and it works fine. After that, I decided to use Greedy Mes
In order to send messages between two objects of class! I implemeted this class User { public: virtual void run() { while (true)
I learn C++ OOP-paradigm and want to ask related question: Assumption We have a base class: class Base { public: virtual SomeType PowerMethod() { return So
I can't seem to find a list of error codes that might be passed into the ec parameter for std::filesystem::copy. cppreference.com seems to indicate that the er
This is my terminal(result) after running the .exe file. Click the link for the terminal. It doesn't stop or gives an error. It's stuck like this for hours. I g
I have unsigned 16 bit image data that I displayed by subclassing QQuickPaintedItem in Qt 5.12.3. I used QImage with Format_RGB32 and scaled the data from [0, 1
#include <iostream> #include <string> void showResults(std::string* r); int main() { std::string students[10] = { "1", "2", "3"
I have unsigned 16 bit image data that I displayed by subclassing QQuickPaintedItem in Qt 5.12.3. I used QImage with Format_RGB32 and scaled the data from [0, 1
How to overload a simple local lambda function? SSE of original problem: #include <iostream> #include <map> void read() { static std::string
consider this code from a library file: #pragma once #include "carla/MsgPack.h" #ifdef LIBCARLA_INCLUDED_FROM_UE4 #include "Carla/Vehicle/VehicleControl.h" #e
What is the fastest method for matrix multiplication of an Eigen::Matrix over a random set of column indices? Eigen::MatrixXd mat = Eigen::MatrixXd::Random(100,
I have a video player program with all C++ code, when I ran it for about half a minute, it segfault. What confuses me is: everytime it segfaults for different r