Category "c++"

Is std::condition_variable::notify_one reentrant?

Can I safely execute following code? Is it possible to have deadlock here or some unexpected behaviour, especially when SIGINT arrives? #include <atomic>

Hazelcast Client Imap issues while using get() function - C++

Is there a way to know the data type before of a hazelcat key before getting the key in Hazelcast 5.0 or later versions? Specifically, my C++ code is: hazelcast

Advantage of using trailing return type in C++11 functions

What is the advantage of specifying a trailing return type in C++11, as opposed to a normal return type? Look at foo1 vs foo2 here: int foo1() { return 1;

Can a non-virtual function be equal to 0?

Can a non-virtual function be equal to 0, e.g., something like void foo() = 0 where the keyword virtual is not in front?

Creating a HTTPS request using Boost Asio and OpenSSL

I have created a simple HTTP request wherein I am sending GET,POST and PUT requests to the server. Next I want to switch to HTTPS connection using boost asio li

Is it possible to flatten an Eigen matrix without copying?

Suppose you have a matrix A: 1 2 3 4 There are two flattenings: 1 2 3 4 and 1 3 2 4 If the default (ColMajor) storage type is used, we can get the latt

How to collapse Gtkmm notebook tabs?

So I am making a Gtkmm application using a Gtk::notebook and during run-time I'm adding new tabs to the notebook. But when I add more tabs than there is space o

Compiling c++ OpenACC parallel CPU code using GCC (G++)

When trying to compile OpenACC code with GCC-9.3.0 (g++) configured with --enable-languages=c,c++,lto --disable-multilib the following code does not use multipl

How to install and use just Clang-Format on Fedora 27?

I'm trying to figure out how to install the stand alone Clang-Format tool. I've downloaded the pre build binaries for Clang from the official download page for

Would the compiler optimize this for loop?

In C or C++, if the compiler encounters a for loop in which a counter is counting from 0 to n, and n is a variable (not a function call, and NOT A CONSTANT eith

Why does my application use more memory on Windows 10?

I have a C++ application compiled with Visual Studio 2010. This is a large legacy application with multiple threads servicing sockets, database connections, RV

SDL_image failing to initialise

When I try and initialise IMG or use IMG_Load, I get the error: "IMG_Init: Failed loading libpng16-16.dll: The specified module could not be found." From what I

load/save multiple images from/in a directory - opencv c++

i want to load a lot of images (not sequential names though) from a directory. edit them and then save them in a different directory with their original names i

do sequentially-consistent atomic loads (load-load pair) form an inter-thread synchronisation point?

I am trying to understand what does sequentially-consistent ordering mean for loads. Consider this artificial example: #include <atomic> #include <thr

What is the purpose of std::launder?

P0137 introduces the function template std::launder and makes many, many changes to the standard in the sections concerning unions, lifetime, and pointers. Wh

How do I insert customType array data in QDBusArgument

I am trying to set and get DNS using QtDBusInterface. As per the documentation, it has "a(iay)" format. which contains an array of IP types and an array of unsi

How can I call functions from one .cpp file in another .cpp file?

I tried looking this up and got mixed results using header files and such. Basically I have multiple .cpp files with all my functions I made for use with binary

Private Data in VMMap is very large on some machines

I'm trying to debug a memory exhaustion issue for my native Win32 CPP app, so far i have found that on some machine when launched, app the memory usage is very

qualified-id in declaration before '(' token

This is some crazy error and is giving me a lot of trouble. #include <iostream> using namespace std; class Book { private: int bookid; char

Is it possible to popcount __m256i and store result in 8 32-bit words instead of the 4 64-bit using Wojciech Mula algorithm's?

I have recently discovered that AVX2 doesn't have a popcount for __m256i and the only way I found to do something similar is to follow the Wojciech Mula algori