Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [c++]

C++ is a general-purpose programming language. Use this tag for questions about/utilizing C++. Do not also tag questions with [c] unless you have a good reason. C and C++ are different languages. Use a versioned tag such as [c++11], [c++20] etc. for questions specific to a standard revision.

-1 votes
0 answers
79 views

What about association in c++ [duplicate]

I don't understand the concept of association in C++. This is my code examples: Association: Object A knows about object B. Class A depends from B but does NOT consist of it Car { ??? }; ...
xzxolop's user avatar
  • 51
2 votes
0 answers
39 views

Attempting to write to disk and check the before and after availability of space using statvfs, but I see no change in blocks available

I am using statvfs to monitor my disk space. I run this program and see no changes in the amount of available blocks within my system, but when I run the df command I am able to see that there's disk ...
Mr.Longbottom's user avatar
-2 votes
1 answer
64 views

Checking rvalue insert result for std::map gives unexpected results [duplicate]

Test code snippet below (CHECK is macro from test framework and works fine): typedef std::map<int, double> M; typedef M::value_type VT; const VT v0; M mm; CHECK(mm.begin() == mm.insert(v0)....
Alexander G.'s user avatar
0 votes
0 answers
34 views

Calling uwp library from unreal engine

I'm trying to use an sdk that is built for .NetCore which I got from Nuget. Since, I can't directly use it in Unreal Engine 4 (.NetFramework), I've made a UWP C# Class library as a wrapper, and I'm ...
Muhammad Murtaza's user avatar
0 votes
2 answers
110 views

C++ configurable classes at compile-time [closed]

Given a class like a counter, I want compile-time configurable features (e.g. on under/overflow call a callback, ...), eg. on a embedded device, not all features are needed. it should be lean also in ...
schnedan's user avatar
  • 264
-1 votes
0 answers
37 views

C++ fstream cannot open file when you run the exe from a different directory [duplicate]

Using ifstream::open() to open a file takes the file path as a parameter. However, it is relative to the location you run the executable from, not to the location of the executable. This means that ...
Someone's user avatar
0 votes
1 answer
36 views

c++ concurrency problem using semaphore: print in order

As an c++ concurrency exercise, I want to print letters A B C in that order, using semaphore. Here's my code: binary_semaphore sem[] = { binary_semaphore(1), binary_semaphore(0), binary_semaphore(0) };...
Wang Tuma's user avatar
  • 1,055
0 votes
0 answers
27 views

How to read a 'CompactSVMModel' save in a .mat file from a C++/Qt program

I tried to save a machine learning model into a .mat file, and then read it from a Qt/C++ application. Following the documentation, I managed to read files containing basic types like double or int. ...
mahNNUser's user avatar
-3 votes
0 answers
58 views

How do I create a window creation function for OpenGL? [closed]

GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "OpenGL", NULL, NULL); if (window == NULL) { cout << "Failed to Create GLFW window" << endl; ...
Metalicious's user avatar
0 votes
2 answers
90 views

How to binary search a std::vector BUT that return a RandomAccessIterator?

I'm looking for a log2(N) way of searching a std::vector and receive a RandomAccessIterator. I want it to work exactly as std::lower_bound() but return a RandomAccessIterator instead of a ...
user1804394's user avatar
0 votes
1 answer
52 views

Cython - How do we implement Tuple of Object in Cython?

I want to implement tuple of object in my cython project. I couldn't find a way to implement in .pyx file so that I can use it in python. You can check my get_language method for some reference. And ...
Punreach Rany's user avatar
1 vote
0 answers
89 views

Getting wrong CPU Processor ID with __cpuid() in Win 11 systems

I am facing an issue in getting CPU Processor ID with C++ code. I used __cpuid() function as below: #include <iostream> #include <intrin.h> int main() { unsigned __int32 regs[4]; ...
Udaya's user avatar
  • 11
0 votes
1 answer
25 views

LLVM linker does not work on MacOS while trying to develop on-chain Solana app (C++)

this is the error i get: ./account_logger.so () dyld[61282]: Library not loaded: @rpath/libLLVM.dylib Referenced from: <A9E4BE2A-BF8D-3956-BCA9-E3BC5A6C9F9C> /Users/myusername/.local/share/...
Tiron Raul's user avatar
0 votes
0 answers
30 views

C++ interface with only one implementation without performance overhead (for mocking in unit tests)

I am making a game engine in C++ and want to start implementing unit tests. As far as I'm aware, you can only create mocks of pure virtual functions. However, because I do not want to add needless ...
Bruno Jácome's user avatar
2 votes
0 answers
43 views

c++ ostream of object implicitly-convertible to string_view does not compile [duplicate]

I have a string-like class that is implicitly convertible to string_view. This works in almost all cases, but not for ostream inserters, where I need to explicitly write an ostream inserter for my ...
Greg's user avatar
  • 421

15 30 50 per page