Category "c++"

transfer a 2d array from python to c++ and back

I am using python to call methods in a shared C++ library. I am having an issue converting a numpy 2D array to a C++ 2D array. I need to enable the following fu

Creating packet sniffer in c++

I have before created a simple packet sniffer using python, with the following code: import socket import os import time host = "192.168.0.164" if os.name ==

Why is the vector subscript out of range?

I'm trying to code this really simple addition program for practice. It takes in a list of inputs and stores it in a vector. Then it grabs each consecutive elem

Why is value-initialization specified as not calling trivial default constructors?

To value-initialize an object of type T means: ... — if T is a (possibly cv-qualified) class type without a user-provided or deleted default constructor,

Retrieve multiple ArrayFire subarrays from min/max data points

I have an array with sections of touching values in it. For example: 0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 0 0 0 0 0 0 0 0

Why are unqualified names from nondependent base classes favored over template parameters

The C++ standard says that unqualified names from nondependent base classes are preferred over template parameters. What is the reasoning behind this? The follo

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