Category "c++"

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

how do you insert the value in a sorted vector?

ALL, This question is a continuation of this one. I think that STL misses this functionality, but it just my IMHO. Now, to the question. Consider following c

is there a way to pass nested initializer lists in C++11 to construct a 2D matrix?

Imagine you have a simple matrix class template <typename T = double> class Matrix { T* data; size_t row, col; public: Matrix(size_t m, size_t n

Using :: (scope resolution operator) in C++

I am learning C++ and I can never tell when I need to use :: . I do know that I need to use std:: in front of cout and cin. Does this mean that inside of the io

how to view std:unordered_map member in GDB

When trying to access a member of std::unordered_map using [], I get an error: Attempt to take address of value not located in memory. There is a nice gdb

Use of observer_ptr

What exactly is the point of the construct std::observer_ptr in the library fundamentals technical specification V2? It seems to me that all it does is wrap a

VSCode C++ Compiled exe was infected with Win32:TrojanX-gen[Trj]

I am setting up VSCode for C++, made some simple code (test.cpp) to test if things are working. #include <iostream> using namespace std; int main(){

Armadillo porting imagesc to save image bitmap from matrix

I have this matlab code to display image object after do super spectrogram (stft, couple plca...) t = z2 *stft_options.hop/stft_options.sr; f = stft_options.

how to print a string to console in c++

Im trying to print a string to console in c++ console application. void Divisibility::print(int number, bool divisible) { if(divisible == true) {

Can't run my built Qt Design Studio (Qt 6) project with CMake on Windows

I'm trying to run a compiled Qt6 project with CMake and mingw64, however, Qt6 apparently can't find QtQuick.Studio.Effects, QtQuick.Studio.Components and QtGrap

VIsual Studio Code error cannot open output file main.exe

This is my first project with Visual Studio Code. When i go to run my "Hello World" project I get this cd "c:\Users\imaco\Desktop\Cpppractice" && g++ ma

Why is there std::logic_error?

I have been told that you will only throw exceptions to handle "external problems", like problems that are not internal, i.e., only with run-time problems. But

Scheduling a coroutine with a context

There are plenty of tutorials that explain how it's easy to use coroutines in C++, but I've spent a lot of time getting how to schedule "detached" coroutines. A

Qt and Intel realsense Getting started

I didn't know where to ask as a beginner. So If you can help... I want to create a project using: Qt 5.15.0 Visual studio 2019 C++ openCV 4.2.0 (if is nece