Category "c++"

generating all permuated products from a map is not working

My code: #include <bits/stdc++.h> using namespace std; using ll = long long; vector<ll> generate_all(map<ll, int> mp, int keys

Tensorflow Op: how to include libtensorflow_framework.so?

I followed the instructions of this tutorial: https://www.tensorflow.org/extend/adding_an_op#implement_the_gradient_in_python. There is this comment provided: g

FetchContent vs ExternalProject

I am building a project with Cmake and use FetchContent to manage dependencies. For several reasons I cannot depend on system-wide installed packages, so this p

Parsing JSON messages in C++

I am writing an embedded C++ MQTT application which subscribes to topics and receives messages every few seconds. I need to parse the received String message an

Passing unsigned int input attribute to vertex shader

In a typical building of a vertex-array-buffer, I am trying to pass an unsigned int attribute along side other classical ones (vertex, normal, texture coordinat

Passing data from Qdialog to main window in Qt

I am trying to pass data from a Qdialog (Login dialog) to my mainWindow after a successful login and was wondering if it is possible to use Signals and slots to

Linker error: "cannot move location counter backwards (from 200009f8 to 20000800)"

I am trying to build my code for Nucleo STM32F042k6 with PlatformIO firmware Mbed but i get the following error: .pio\build\nucleo_f042k6\STM32F042X6.ld.link_s

How to compress a C++ string using Zstd?

I'm very new to C++ and I wanted to compress a std:string object via Zstd compression library, but so far I couldn't find a C++ sample code for this purpose by

Are there any well performing methods for representing a NA in a array?

Note I'm specifically referring to the term NA and not NaN because I'm not including only number types I've been attempting to represent NA values within arrays

Escape sequences for char8_t and unsigned char

Trying to use escape sequences to construct a char8_t string (to not rely on file/compiler encoding), I got issue with MSVC. I wonder if it is a bug, or if it i

Cppdepend handling from command line

I´ve downloaded the CppDepend static code analyzator, to analyze my .cpp programs. It seems to have a nice visual APK to manage my files, however, I´

Why is "std::is_pointer<std::nullptr_t>::value" equal to false?

I read about std::is_pointer in C++. Then I wrote the program and check whether T is a pointer type or not using std::is_pointer. #include <iostream> i

Add texts with line breaks in Win32 API ListView

I am using the WC_LISTVIEW control to create a table that is filled with data at runtime. The table is working fine. However, I cannot display multiple lines in

Append to existing tuple in c++

i am trying to make a thing to store types in list. The best thing is to use a tuple. then to get the type i use tuple_element_t. But the problem is when append

A pthread with SCHED_RR and higher real time priority failed to preempt a kthread in kernel module with lower priority

Preface: I have two threads: one kernel thread and one userspace pthread. I assume pthread set to SCHED_RR with higher rt priority should preempt a kthread with

Which of these answers are the equivalent of O_RDWR on Ubuntu 14.04 LTS?

I have been given a list of the following check box containing all possible solutions to the question of choosing all true answers equivalent to O_RDWR on Ubunt

Why does std::pair return such a random 'second' value?

The issue is that I want to return a pair containing my key and value {8, 8} for example. Instead I get a rather random pair back {8, 19259321} for example, and

How was a standard windows 7 user able to delete files under C:\Program Files?

In c++, the DeleteFile() function shouldn't allow standard users to delete files under C:\Program Files, but someone running the program was able to do this! H

Can modern x86 hardware not store a single byte to memory?

Speaking of the memory model of C++ for concurrency, Stroustrup's C++ Programming Language, 4th ed., sect. 41.2.1, says: ... (like most modern hardware) the

What does the "operator()..." syntax mean in C++?

I'm trying to understand the example of std::visit from cppreference, Where I saw the following line of code: template<class... Ts> struct overloaded : T