Category "c++"

Glade Toggle Button save state

so what i am trying to accomplish is that i have a glade project in linux with a toggle button, when a user presses the toggle button and and eventually closes

gtest - testing template class

I want to test a template class with gtest. I read about TYPED_TESTs in Google Test manual and looked at official example they reference, but still can't wrap m

Idiomatically split a string_view

I read The most elegant way to iterate the words of a string and enjoyed the succinctness of the answer. Now I want to do the same for string_view. Problem is,

Redefinition error in propidlbase.idl when compiling ATL project in Visual Studio 2019

I am trying to migrate a previous an older project from Visual Studio 2010 to a current version of Visual Studio (2019). I Microsoft's change notes on upgrading

Cannot find module '../build/Release/opencv4nodejs

I am new to OpenCV and node js, trying to learn OpenCV in node js. I came across opencv4nodejs which I found best for learning. I have followed all steps to ins

Sum function with return type large enough to hold result

It's a question from C++ Primer Chapter 16.2.3 (question 16.41): Write a version of sum with a return type that is guaranteed to be large enough to hold t

Using chromium embedded framework inside qt application

I am investigating the option of using chromium embedded framework in C++ desktop application to implement new HTML views. The issue is all the GUI are implemen

C++ sorting an array in ascending order Printing

Im trying to sort an array in ascending order and print it out and Im having trouble of where to put my cout in my code. for (int k=0; k<ARRAY_SIZE; k++) {

Does a constructor has a "type" in C++ since it is a special member function

I recently learnt that constructors do not have names in C++ and some other things about them. I am also aware that a function has a type in C++ called a functi

C++ - Split string by regex

I want to split std::string by regex. I have found some solutions on Stackoverflow, but most of them are splitting string by single space or using external lib

Pass Parameter to Base Class Constructor while creating Derived class Object

Consider two classes A and B class A { public: A(int); ~A(); }; class B : public A { public: B(int); ~B(); }; int main() { A* aobj; B

"'omp.h' file not found" when compiling using Clang

I'm trying to set up an OpenMP project using Clang (3.7.0) on my laptop running Linux Mint. Now I've read that OpenMP is not supported right away so I followed

Is using a vector of boolean values slower than a dynamic bitset?

Is using a vector of boolean values slower than a dynamic bitset? I just heard about boost's dynamic bitset, and I was wondering is it worth the trouble. Can I

Does gcc use Intel's SSE 4.2 instructions for text processing if available?

I read here that Intel introduced SSE 4.2 instructions for accelerating string processing. Quote from the article: The SSE 4.2 instruction set, first implement

Creating undirected weighted graph from adjancency matrix from a csv

I want to create undirected weighted graph of a given adjacency matrix by reading it from a csv. I can read it from a csv but I don't know how to draw its in gr

shrink_to_fit() for unordered containers?

I am wondering two things... Does it make any sense to resize an unordered containers in a manner similar to shrink_to_fit() once the container has been filled

C/C++ unsigned integer overflow

i'm reading an article about integer security . here's the link: http://ptgmedia.pearsoncmg.com/images/0321335724/samplechapter/seacord_ch05.pdf In page 166,th

opengl - how to put texture on 3d irregular object

I have to create animation where gatling gun will be shoot (it doesn't have to be complex, cause it's just a practice). I drew basic version of my gun which loo

Cmake executable with auto-generated sources

I want to make an executable from, for example, test_runner.cpp: add_executable(myexe ${CMAKE_CURRENT_BINARY_DIR}/test_runner.cpp) But this particular cpp fi

Is it possible to initialize the fixture only once and use it in multiple test cases?

Is it possible to have the fixture initialized only once and use it in multiple test cases within the same test suite? In the following example, fixture is cons