Top "Stl" questions

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

Advantages of std::for_each over for loop

Are there any advantages of std::for_each over for loop? To me, std::for_each only seems to hinder …

c++ stl foreach coding-style
C++ Double Address Operator? (&&)

I'm reading STL source code and I have no idea what && address operator is supposed to do. Here …

c++ stl operator-keyword memory-address
Copy map values to vector in STL

Working my way through Effective STL at the moment. Item 5 suggests that it's usually preferable to use range member functions …

c++ stl containers
Is std::vector copying the objects with a push_back?

After a lot of investigations with valgrind, I've made the conclusion that std::vector makes a copy of an object …

c++ stl stdvector
Case insensitive std::string.find()

I am using std::string's find() method to test if a string is a substring of another. Now I need …

c++ string stl case-insensitive wstring
How can I use std::maps with user-defined types as key?

I'm wondering why I can't use STL maps with user-defined classes. When I compile the code below, I get the …

c++ dictionary stl containers stdmap
Can't include C++ headers like vector in Android NDK

When I try to include any C++ class like vector in my Android NDK project (using NDK r5b, the …

android stl vector android-ndk
How to avoid memory leaks when using a vector of pointers to dynamically allocated objects in C++?

I'm using a vector of pointers to objects. These objects are derived from a base class, and are being dynamically …

c++ stl pointers vector derived
How to increment an iterator by 2?

Can anybody tell me how to increment the iterator by 2? iter++ is available - do I have to do iter+2? …

c++ visual-c++ stl iterator
When vectors are allocated, do they use memory on the heap or the stack?

Are all of the following statements true? vector<Type> vect; //allocates vect on stack and each of the …

c++ stl vector stack heap