Top "Std" questions

The C++ Standard Library, and its namespace.

How to convert from UTF-8 to ANSI using standard c++

I have some strings read from the database, stored in a char* and in UTF-8 format (you know, "á" is encoded …

c++ stl std crt
std::pair of references

Is it valid to have a std::pair of references ? In particular, are there issues with the assignment operator ? According …

c++ std
std::move between std::string and std::vector<unsigned char>

I am working with 2 libraries. One takes in and returns std::strings while the other uses std::vector<unsigned …

c++ string vector std unsigned-char
What's the difference between std::advance and std::next?

Is there more beyond advance takes negative numbers?

c++ c++11 std
Delete std::thread after calling join?

I have some code that dynamically allocates a new std::thread from the C++11 <thread> header, like this: …

c++ multithreading c++11 std stdthread
variable-length std::array like

As my usually used C++ compilers allow variable-length arrays (eg. arrays depending on runtime size), I wonder if there is …

c++ std variable-length-array
How to truncate a file while it is open with fstream

I know it is possible to truncate a file with std::fstream fs(mypath, std::fstream::out | std::fstream::trunc); …

c++ std fstream
Smart pointers in container like std::vector?

I am learning about smart pointers (std::auto_ptr) and just read here and here that smart pointers (std::auto_…

c++ pointers std smart-pointers auto-ptr
What operations are thread-safe on std::map?

Suppose I have: stl::map<std::string, Foo> myMap; is the following function thread safe? myMap["xyz"] ? I.…

c++ multithreading dictionary std c++-standard-library
How to inspect std::string in GDB with no source code?

I'm trying to debug a program that has no source code available, and I need to look at what it …

c++ stl gdb std c++-standard-library