Top "Stl" questions

The Standard Template Library, or STL, is a C++ library of generic containers, iterators, algorithms, and function objects.

Is std::vector so much slower than plain arrays?

I've always thought it's the general wisdom that std::vector is "implemented as an array," blah blah blah. Today I …

c++ arrays performance stl vector
Why doesn't C++ require a "new" statement to initialize std::vector?

/* bar.h */ class bar{ /* standard stuff omitted */ std::vector<my_obj*> foo; }; /* bar.cpp */ bar::bar(){ // foo = new …

c++ stl stdvector
How can I display the content of a map on the console?

I have a map declared as follows: map < string , list < string > > mapex ; list< string > …

c++ dictionary stl stdmap
Copying std::vector: prefer assignment or std::copy?

I have two vectors: std::vector<int> v1, v2; // Filling v1 ... And now I need to copy v1 …

c++ stl copy
C++ remove_if on a vector of objects

I have a vector (order is important) of objects (lets call them myobj class) where I'm trying to delete multiple …

c++ vector stl predicate
How to iterate over a C++ STL map data structure using the 'auto' keyword?

So far I have always used an iterator for traversing through all the keys in an STL map as follows: …

c++ dictionary c++11 stl auto
UTF8 to/from wide char conversion in STL

Is it possible to convert UTF8 string in a std::string to std::wstring and vice versa in a platform …

c++ unicode stl utf-8 character-encoding
Checking if an iterator is valid

Is there any way to check if an iterator (whether it is from a vector, a list, a deque...) is (…

c++ stl iterator dereference
What happens if you call erase() on a map element while iterating from begin to end?

In the following code I loop through a map and test if an element needs to be erased. Is it …

c++ stl iterator
Is the order of iterating through std::map known (and guaranteed by the standard)?

What I mean is - we know that the std::map's elements are sorted according to the keys. So, let's …

c++ dictionary stl standards