How to store a value obtained from a vector `pop_back()` in C++??

I'm not sure how to cast a value obtained from the pop_back() function of vector. The following is a simple code to ...

std::vector::resize() vs. std::vector::reserve()?

There is a thread in the comments section in this post about using std::vector::reserve() vs. std::vector::resize()....

“Missing MSCVP140.dll” and “Missing VCRUNTIME140.dll” when running an .exe-File on another computer?

I made a program in Microsoft Visual Studio C++ and used the SFML for this. I included the correct .dll-Files, that ...

Compiler generates costly MOVZX instruction?

My profiler has identified the following function profiling as the hotspot. typedef unsigned short ushort; bool is...

Is it a good practice to use unions in C++??

I need to define a class like this: class Color { private: union Data { unsigned int intValue; ...

compute mean using std::accumulate fails?

I'm trying to compute the mean value of a vector of doubles using the following code (compiled with g++ mean.cc -std...

outFile C++ not writing to output text?

Down below is my incomplete program. I am having problems with writing to a text file. For example I want to write t...

What is lock-free multithreaded programming??

I have seen people/articles/SO posts who say they have designed their own "lock-free" container for multithreaded us...

How to use std::atomic<>?

I have a class that I want to use in different threads and I think I may be able to use std::atomic this way: class...

How to properly use SDL_BlitSurface() with SDL_CreateRGBSurface()??

(See "Edit 2" below for the solution.) I need to create SDL surfaces from scratch, instead of loading them from a f...

.gdbinit file missing?

Eclipse is not debugging my c++ code. It asked for a version of gdb. I fixed the path of gdb but .gdbinit file is st...

Static Functions in C++?

I've read a few posts on here about static functions, but still am running into trouble with implementation. I'm wr...

Cern ROOT - How to read contents from a TTree root file into array?

I am trying to read data in from a Cern ROOT TTree file. I have not used root before and I am struggling a bit with ...