Category "c++"

Leetcode C++ error: reference to non-static member function must be called

when I was doing Leetcode, I wrote my codes as follows: class Solution { public: bool compare(vector<int> a, vector<int> b) { return

How does os figure if a dll is already loaded in memory or how does os figure two dll are the same?

In my comprehension, "dll/so" can be shared between programs(processes). for example when "libprint.so" is loaded in "main"(called main1) at first time, "libpri

Is Q_INTERFACES macro needed for child classes?

If I have class A that implements an interface (and uses Q_INTERFACES macro), then does child class B : public A also need to use the Q_INTERFACES macro? For ex

How can I *directly* append to a QVariantList, stored in a QVariantMap?

I have a collection of QVariantMaps which contains QVariantLists in SOME of their entries. I need to append to the lists. These lists can grow rather large, an

Using QSGTexture/QSGMaterial and Qt's RHI to implement a custom texture format for shaders

With Qt 6.2 there is a whole system of "graphics API independent" infrastructure (both on tooling and on C++ side) that enables you to render things in e.g. QML

Returning a struct pointer from class method

EDIT: Changed example code to code from my project that doesn't work. I'm writing code in C++, learning templates and got stuck with some problem. There's a cla

Where a const reference refers to? [duplicate]

There is a simple program #include <stdio.h> int counter = 3; const int& f() { return counter++; } const int& g() { r

Enter is converted to gibberish code after system()

When I use C++ to invoke Python program output (By system command with parameters), it outputs gibberish code at the end of line. After that, I couldn't input a

Zip directory recursion

I am working on creating zip archive using old Qt - ZipWriter class. The problem is when I want to add the directory. The default Qt code for addDirectory metho

Checking the last accessed files on Windows 10 in C++

I'm writing a small tool to help my workflow as an artist, and it'd be neat if it could check a list of recently accessed files on my computer for a *.psd (phot

Returning MIME data from a function in Qt

I am trying to create a class with drag and drop. I want it to be used as a base class for future derived classes. I want derived classes to specify MIME data f

Inline out-of-class member function definition [duplicate]

struct S { void foo(); }; inline void S::foo() {} Can't figure out from the documentation if this function is considered inline or not.

UWP Extended Foreground Session

So, I have made a few attempts to create an app in UWP, using C++/CX, and besides dreading the syntax, I had some fun. I ran into troubles when I attempted to p

Why is it skipping Sprite.setTexture()?

I have been trying to run my code and it has been skipping this line this->tileSprite.setTexture(this->tileTexture); within the constructor of my class T

How to sort vector of structs by given field?

I need to sort vector of structures by a given field. To anyone who faces the same problem: I just made my own sort function and there you can pass in lambda as

Changing a defined constant in a dll compilated file from external application

Please, help me to figure out this. I have the following code in C (example): #define cutoff 22; double age; if (age == cutoff) { cout << "Good morning

What is atltime.h in MFC

Can someone will explain to me What is atltime.h ? I don't know how this header works. I tried to search it on google but i didn't get an answer of what atltime

How to know when a char* library function arg needs an array it can modify, not a char pointer

I am new to C programming. and I know char * and char[] array are different. Yet, you can deduct the char[] to char * when it comes to a function param. So func

Trouble extracting numbers from helib::Ctxt ciphertext

I'd like to access directly to the numbers composing the ciphertext Ctxt from HElib, but reading the documentation I don't seem to find anything that can help m

Detected memory leaks in shared_ptr copy constructor

All the code is included in this post. For some reason, it tells me that, a memory leak is happening at shared_ptr.hpp(60), assuming this must be line 60 here.