Top "Stl" questions

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

How to convert wstring into string?

The question is how to convert wstring to string? I have next example : #include <string> #include <iostream&…

c++ unicode stl wstring
How to get a certain element in a list, given the position?

So I've got a list: list<Object> myList; myList.push_back(Object myObject); I'm not sure but I'm …

c++ list stl
maximum value of int

Is there any code to find the maximum value of integer (accordingly to the compiler) in C/C++ like Integer.…

c++ c stl limits numeric-limits
How to set initial size of std::vector?

I have a vector<CustomClass*> and I put a lot of items in the vector and I need …

c++ stl
Sorting a vector in descending order

Should I use std::sort(numbers.begin(), numbers.end(), std::greater<int>()); or std::sort(numbers.rbegin(), numbers.…

c++ sorting stl vector iterator
How to remove all the occurrences of a char in c++ string

I am using following: replace (str1.begin(), str1.end(), 'a' , '') But this is giving compilation error.

c++ stl
Why does the C++ STL not provide any "tree" containers?

Why does the C++ STL not provide any "tree" containers, and what's the best thing to use instead? I want …

c++ data-structures tree stl
How do I remove an item from a stl vector with a certain value?

I was looking at the API documentation for stl vector, and noticed there was no method on the vector class …

c++ stl
C++ equivalent of StringBuffer/StringBuilder?

Is there a C++ Standard Template Library class that provides efficient string concatenation functionality, similar to C#'s StringBuilder or …

c++ stl string-concatenation
Replace an element into a specific position of a vector

I want to replace an element into a specific position of a vector, can I just use an assignment: // vec1 …

c++ visual-c++ vector stl insert