Can I create an std::vector using my pre-existing data instead of it allocating new memory and copying the data? To be clearer, if I have a memory area (either
I know in C++11 they added the feature to initialize a variable to zero as such double number = {}; // number = 0 int data{}; // data = 0 Is there a simila
I am trying to understand Hierarchy and findContours, from opencv c++, but am finding it difficult. I did go through this question here, but I still am not abl
Scott Meyers writes in Effective Modern C++ (Item 30 page 210) that there's no need to define integral static const data members in classes; declarations alone
I'm trying to perform a basic JPEG Compression (DCT + quantization + IDCT) using OpenCV not using entropy-encoding/Huffman-coding. The problem is that after I d
I am planning to start cuda programming in Qt framework. I would like to start with a simple example. system information : OS : ubuintu 18.04 LTS Qt version : 5
Is there a way to take two int arrays in C++ int * arr1; int * arr2; //pretend that in the lines below, we fill these two arrays with different //int values
I would like to access to a tuple element at compile time by a value constexpr in the type #include <iostream> #include <tuple> #include <utility
I am new to the C++ language. I have been starting to use vectors, and have noticed that in all of the code I see to iterate though a vector via indices, the fi
What are the benefits of a header only library and why would you write it that way oppose to putting the implementation into separate file?
This declaration: char constexpr *const s = "hello"; Fails with this error: g++ -g -Wall -Werror -std=c++17 test.cc -o test test.cc:8:31: error: ISO C++11 d
What is the C++ way of checking if an element is contained in an array/list, similar to what the in operator does in Python? if x in arr: print "found" els
I want to know if we can have recursive macros in C/C++? If yes, please provide a sample example. Second thing: why am I not able to execute the below code? Wh
I am trying to figure out how to create a window for my project. I want to work with OpenGL ES and I found online guides on how to use X11 and EGL for creating
If I understand correctly, a weak_ptr doesn't increment the reference count of the managed object, therefore it doesn't represent ownership. It simply lets you
Suppose we have an enum like the following: enum Days {Saturday, Sunday, Tuesday, Wednesday, Thursday, Friday}; I want to create an instance of this enum and
As far as I can tell it is possible for a queue family to support presenting to the screen but not support graphics. Say I have a queue family that supports bot
I'm trying to implement a simple serialization/deserialization method for my code to be able to pass an object over the network using MPI. In an ideal world I w
I have this code: In the header: ... int32_t round(float v); ... and in the source ... int32_t round(float v) { int32_t t = (int32_t)std::floor(v);
Can you please point me into the right direction? I want to edit other application textbox or click, programmatically. For example, in a web