Category "c++"

How to correctly initialize an event

I'm a student and currently experimenting with the QoS-settings in ROS 2. I'm trying to implement the (RMW_EVENT_REQUESTED_DEADLINE_MISSED) event. First I decla

up to 20% Numerical error or Bug in ten line code block [closed]

Rewriting a single tiny block of code of an application has yielded a considerable performance improvement. The code is 100% sequential, thus

How to run a member function in QtConcurrent in QT6

i try to run a member function with QtConcurrent. I am just learning c++ and qt and i used the way i found in their official documentation: https://wiki.qt.io/Q

How to paint binary tree in red-black

I have already created binary tree, and i have to paint every node in red or black to make red-black tree. struct node { string name; int year; int

How to initiate multiple structs

I'm fairly new to C++. Have a struct Bbox with a constructor with two arguments x and y which I have just added. Before when the constructor had no arguments I

it says i have errors but there are no errors [closed]

I have tried to run the program with more than one inheritance i got many errors For this program ,but when i use it for Source File, it will

QComboBox , tabviews, C++

I am developing an application with tabviews. I want that tabView to change the widget depending on the ComboBox choice. ex: if the first index chosen I want ta

What is the order of control flow while compiling the code for a class in C++?

I am compiling a class, the complete program to which is given below: #include<iostream> using namespace std; class Test{ public: Test()

Why is my parallel std::for_each only using 1 thread?

I'm trying to parallelize this C++ code (computing a continuous Fourier transform of points, modeled as Dirac impulses), and this code compiles and works correc

What is the equivalent to JavaScript setInterval in C++?

The following code prints the argument passed to the function foo in every 5 second interval. function foo(arg) { console.log(arg); } setInterval(() => fo

C++ - How to debug SIGILL ILL_ILLOPN

Recently I ran into a crash while the following statement is getting executed static const float kDefaultTolerance = DoubleToFloat(0.25); where DoubleToFloat

Seeking helps in explanation of syntax for var[x[n]]

How does the below syntax work? class Solution { public: int lengthOfLongestSubstring(string s) { const int n = s.length();

Music Chairs problem implementation in C++

I am currently practicing algorithms and DS. I have stumbled upon a question that I can't figure out how to solve. So the question's link is there: In summary,

Ctypes: OSError: exception: stack overflow

C++ this code work in exe, but not working in dll when python is used. Python throw this error when program run to dec(&buffer2, &length, &buffer);

Tasks.json does not accept wildcard for multiple files

I have a folder with multiple cpp files that I want to compile to a DLL with g++ (MinGW). My Tasks.json looks like this: { // See https://go.microsoft.com/fwlin

relocation against xxx in read-only section '.text' - wrong compiler or linux setup in SUSE?

I'm not a frequent user of Linux and I think I did something wrong. This is the code for a test dynamic library ".so" I'm generating. class InternalClass { publ

VS code error "Permission Denied" when printing simple output

I am trying to set up my c++ environment in Visual Code Studio but the error here is Permission denied and I tried giving it administrator permission but it did

How to use c++20 modules with CMake?

Clang and MSVC already supports Modules TS from unfinished C++20 standard. Can I build my modules based project with CMake or other build system and how? I tri

How to define a non blocking input in C++

I'm making a multithread application in C++. In particular, a secondary thread is involved in input operations, the problem is that std::cin is a blocking instr

RocksDb: Multiple values per key (c++)

RocksDb: Multiple values per key (c++) what i am trying to do I am trying to adapt my simple blockchain implementation to save the blockchain to the hard drive