Category "c++"

Passing data from Qdialog to main window in Qt

I am trying to pass data from a Qdialog (Login dialog) to my mainWindow after a successful login and was wondering if it is possible to use Signals and slots to

Linker error: "cannot move location counter backwards (from 200009f8 to 20000800)"

I am trying to build my code for Nucleo STM32F042k6 with PlatformIO firmware Mbed but i get the following error: .pio\build\nucleo_f042k6\STM32F042X6.ld.link_s

How to compress a C++ string using Zstd?

I'm very new to C++ and I wanted to compress a std:string object via Zstd compression library, but so far I couldn't find a C++ sample code for this purpose by

Are there any well performing methods for representing a NA in a array?

Note I'm specifically referring to the term NA and not NaN because I'm not including only number types I've been attempting to represent NA values within arrays

Escape sequences for char8_t and unsigned char

Trying to use escape sequences to construct a char8_t string (to not rely on file/compiler encoding), I got issue with MSVC. I wonder if it is a bug, or if it i

Cppdepend handling from command line

I´ve downloaded the CppDepend static code analyzator, to analyze my .cpp programs. It seems to have a nice visual APK to manage my files, however, I´

Why is "std::is_pointer<std::nullptr_t>::value" equal to false?

I read about std::is_pointer in C++. Then I wrote the program and check whether T is a pointer type or not using std::is_pointer. #include <iostream> i

Add texts with line breaks in Win32 API ListView

I am using the WC_LISTVIEW control to create a table that is filled with data at runtime. The table is working fine. However, I cannot display multiple lines in

Append to existing tuple in c++

i am trying to make a thing to store types in list. The best thing is to use a tuple. then to get the type i use tuple_element_t. But the problem is when append

A pthread with SCHED_RR and higher real time priority failed to preempt a kthread in kernel module with lower priority

Preface: I have two threads: one kernel thread and one userspace pthread. I assume pthread set to SCHED_RR with higher rt priority should preempt a kthread with

Which of these answers are the equivalent of O_RDWR on Ubuntu 14.04 LTS?

I have been given a list of the following check box containing all possible solutions to the question of choosing all true answers equivalent to O_RDWR on Ubunt

Why does std::pair return such a random 'second' value?

The issue is that I want to return a pair containing my key and value {8, 8} for example. Instead I get a rather random pair back {8, 19259321} for example, and

How was a standard windows 7 user able to delete files under C:\Program Files?

In c++, the DeleteFile() function shouldn't allow standard users to delete files under C:\Program Files, but someone running the program was able to do this! H

Can modern x86 hardware not store a single byte to memory?

Speaking of the memory model of C++ for concurrency, Stroustrup's C++ Programming Language, 4th ed., sect. 41.2.1, says: ... (like most modern hardware) the

What does the "operator()..." syntax mean in C++?

I'm trying to understand the example of std::visit from cppreference, Where I saw the following line of code: template<class... Ts> struct overloaded : T

error: type ‘class’ is not a direct base of ‘class’

I haven't been able to find an answer that relates specifically to my question. It's a bit of a "strange" case in terms of what I've seen. So I have a class C

Show compiler command line of CMake with Visual Studio 2019

I am using open folder functionality of VS2019, and I would like to see flags being used to compile my code. Compilation database does not seem to be generated

How to add layer on top of file system? Like cache in OneDrive or Google Drive

I'm looking for a way (using C# .Net or C++ and WinApi or anything) to add a layer between filesystem and client application to add custom behaviour. Like OneD

In depth understanding of Monad

At one time, I thought I understood Monad. However, when I try to connect my understanding of code to the piece of theory, I found myself still not clear. So he

Finding number of inversions in given array

I have written the following code to find the inversions in array {1,4,2,5,3} by using merge sort technique. I have been debugging it to the best of my knoledge