Top "Stl" questions

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

How do I clear the std::queue efficiently?

I am using std::queue for implementing JobQueue class. ( Basically this class process each job in FIFO manner). In one …

c++ data-structures stl queue
How to update std::map after using the find method?

How to update the value of a key in std::map after using the find method? I have a map …

c++ map stl stdmap
How to sort an STL vector?

I would like to sort a vector vector<myClass> object; Where myclass contains many int variables. How can …

c++ sorting stl
Why can I not push_back a unique_ptr into a vector?

What is wrong with this program? #include <memory> #include <vector> int main() { std::vector<std::…

c++ stl c++11 smart-pointers unique-ptr
I want to convert std::string into a const wchar_t *

Is there any method? My computer is AMD64. ::std::string str; BOOL loadU(const wchar_t* lpszPathName, int flag = 0); When …

c++ stl wchar-t stdstring
How do I reverse a C++ vector?

Is there a built-in vector function in C++ to reverse a vector in place? Or do you just have to …

c++ vector stl std
How to get std::vector pointer to the raw data?

I'm trying to use std::vector as a char array. My function takes in a void pointer: void process_data(…

c++ stl vector
C++ STL Vectors: Get iterator from index?

So, I wrote a bunch of code that accesses elements in an stl vector by index[], but now I need …

c++ stl vector iterator
How do I sort a vector of pairs based on the second element of the pair?

If I have a vector of pairs: std::vector<std::pair<int, int> > vec; Is there …

c++ stl stdvector
Use of for_each on map elements

I have a map where I'd like to perform a call on every data type object member function. I yet …

c++ algorithm stl stdmap std-pair