Category "c++"

The configuration option popup for debugging a c++ project in Visual Studio Code does not appear

so I want to debug my .cpp program file but when I click on the Run and Debug button and proceed to select my debugging environment (C++ (GDB/LLDB)), the popup

std::enable_if based on expression using static constexpr member function

Is the following code legal C++11? #include <type_traits> template<typename T> typename std::enable_if<T::Data() == nullptr>::type test (T t

Remove Duplicates from sorted list not passing all testcases

This is a question on leetcode. For some reason my code only works for 7/164 test cases. i would like to know why my algorithm is not efficient. what is a solut

CPP program background waiting for jobs

I want to split up the following workflow of a C++ program: Read serialized data (1 sec, which is already very fast for that size) Search data (0.01 ms) Return

Ensure that char pointers always point to the same string literal

Given the code // somewhere in the program const char* p1 = "Hello World"; // somewhere else in the program const char* p2 = "Hello World"; is there a way t

Qt Window incorrect size until user event

I'm creating a screen where users can add certain tiles to use in an editor, but when adding a tile the window does not correctly resize to fit the content. Exc

Reading stack pop/push operations by text-file input

I have a text file with the following contents: 2 S 8 push 2 push 3 push 5 push 7 pop print push 6 print S 4 pop print push 1 print An assignment gives: The f

Problems with cout and a specific string length arithmatic operation c++

This is my first attempt at LCS. The problem I have is with the last portion. When the two input strings are 'mango' and 'man', it seems that cout keeps messing

OpenGL two rotations on one model

I have loaded a model of a coin, and I want it to constantly rotate around its axis: model = glm::rotate(model, (float)glfwGetTime(), glm::vec3(0, 1, 0)); But

Concise RAII for Trompeloeil mocks

I have classes like this: /* "Things" can be "zarked", but only when opened, and they must be closed afterwards */ class ThingInterface { public: // Open the

Compilation error C2048 while compiling in visual studio 2019 MSVC, but works fine with clang++?

I tried to compile the following sample code with clang compiler and it works fine. Compiler Details: Apple clang version 12.0.0 (clang-1200.0.32.28) Target: x

Implementation of scipy.signla.filtfilt in c++? [closed]

I am trying to implement scipy.signal.filtfilt function in c++ and I am wondering if there is already an implementation available of this?

Lvalue-to-rvalue conversion for class types: is there copying involved?

(I asked this question before but didn't give a viable example so I deleted previous one. I hope on this one I got the example right.) Case: #include <iostre

Pure OpenGL on Windows? [duplicate]

I want to use OpenGL without GLFW, the docs say that I need to add opengl32.lib to linker dependencies. How do I specifically import OpenGL an

What is the meaning of Google Benchmark Iteration?

I am working with Google Benchmark to measure the execution time of some code. For example, I wrote the following code to measure its execution time performance

Find place that causes segmentation fault without IDE

I'm studying one project in C++. It's quite big, build is created with cmake. After installing all dependencies and libs it's the build is done fine. But when I

Performing matrix-operations (e.g. product and inverse) over GF(2^6) in C++

I want to implement some matrix operations such as product and inverse computation over a Galois Field GF(64) in C++ language. I have normally used Eigen libra

Embedding Python in DLL: Access violation reading location when Py_DECREF list object

I am trying to embed Python into an an XLL to allow Python functions to be called within Excel. An XLL is a DLL that also includes at a minimum 2 functions that

C++ Read txt and put each line into Dynamic Array

I am trying to read input.txt file, and trying to put each line into the array as string (later on I will use each element of array in initializing obj that's w

CMake 'undefined reference' error with CERN-ROOT

I'm writing a small addition to CERN ROOT and now can't get rid of 'undefined reference' errors on every function from ROOT that I use (and my classes too). Can