Category "c++"

why are my first and second LED not lighting up? is it a problem with the for loops?

When I power my Arduino it only lights up the 2-5 and leds and skips the 1st and the 6th led. I tried seeing what's the problem by giving a check on the value o

Installation of taichi legacy branch on ubuntu 20.04

I am willing to work with code spgrid_topo_opt which needs taichi legacy to be installed first. To install taichi legacy following the instruction on the page I

How to find a substring in only a portion of a std::string?

I have a std::string and i want to be able to find text only in a section of it : so i need to specify a start and an end position. In std::string::find() one c

How to find a substring in only a portion of a std::string?

I have a std::string and i want to be able to find text only in a section of it : so i need to specify a start and an end position. In std::string::find() one c

Having problem Understanding fork() hierarchy tree

I have this Code that I can't understand. I understood the basics of fork() but I don't understand the Hierarchical tree for this process. The code is like this

How to test the problem size scaling performance of code

I'm running a simple kernel which adds two streams of double-precision complex-values. I've parallelized it using OpenMP with custom scheduling: the slice_indic

Cant cout item in container with std::any

This script #include <iostream> #include <unordered_map> #include <any> using namespace std; int main() { unordered_map<int, any> t

Can I serialize a class by casting it to a char*

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

Downloading only specific AWS C++ SDKs using CMake's FetchContent

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

Using #define for a function [duplicate]

After struggling with C++ typedef and define, I've tried myself some code and here it is: #include <iostream> #include <string> #d

Find the number of steps a string can be reduced to 0

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

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