Category "c++"

Accessing variables of main() function inside signal handler in C++

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

Is there a standard way to get the nth `nextafter` floating-point value in C++

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

c++ Best practise when passing in arguments to functions [closed]

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

Using Texture Atlas as Texture Array in OpenGL

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

Using queue Between two object of class

In order to send messages between two objects of class! I implemeted this class User { public: virtual void run() { while (true)

Architecture of sub-classes in C++

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

What are the possible error codes that can be returned when calling std::filesystem::copy()?

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

CGAL: Hole Filling .exe file is stuck

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

QImage 16 bit grayscale with QQuickPaintedItem

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

What is preventing me from running this code? [closed]

#include <iostream> #include <string> void showResults(std::string* r); int main() { std::string students[10] = { "1", "2", "3"

QImage 16 bit grayscale with QQuickPaintedItem

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

Overload a lambda function

How to overload a simple local lambda function? SSE of original problem: #include <iostream> #include <map> void read() { static std::string

function-style casts in UE4

consider this code from a library file: #pragma once #include "carla/MsgPack.h" #ifdef LIBCARLA_INCLUDED_FROM_UE4 #include "Carla/Vehicle/VehicleControl.h" #e

Matrix multiplication of an Eigen Matrix for a subset of columns

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,

Weird segfault in 3rd party

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

How to access a topic in a ROS2 action server

In an ROS2 action server callback function, I need to access data which is published on some ROS topic. How can I achieve this, in a straightforward and clean w

Can a c++ class own subclasses

Lets say you have the class a and you want to add a child class b how would you go by doing this? Maybe something like this: class a{ public: class b{

Why std::string relational operator comparison result is different for a template and a function?

In the following code, both the template and the function compare two strings and return which one is bigger. However, despite the same code (definition body),

How can I effectively use boost::process::async_pipe for both writing and reading?

I've already seen the boost::process tutorial... but there the example is a single write then a single read from the child process. I want to know if it is poss

AudioKit Cookbook v.5 build fails (xcode 13.2.1)

I have been trying to build, to no avail, the Cookbook under Xcode 13.2.1. I get "Analyze Failed" with the following errors: Stk: Command CompileSwiftSources fa