Top "Stdvector" questions

std::vector is a contiguous sequence container in the C++ standard library.

How to print out the contents of a vector?

I want to print out the contents of a vector in C++, here is what I have: #include <iostream&…

c++ vector output stdvector cout
In C++ check if std::vector<string> contains a certain value

Is there any built in function which tells me that my vector contains a certain element or not e.g. …

c++ vector std stdvector
Fastest way to reset every value of std::vector<int> to 0

What's the fastest way to reset every value of a std::vector<int> to 0 and keeping the vectors …

c++ reset stdvector
Efficient way to return a std::vector in c++

How much data is copied, when returning a std::vector in a function and how big an optimization will it …

c++ return-value stdvector
C++, copy set to vector

I need to copy std::set to std::vector: std::set <double> input; input.insert(5); input.insert(6); std::…

c++ copy stdvector stdset
How to compare two vectors for equality element by element in C++?

Is there any way to compare two vectors? if (vector1 == vector2) DoSomething(); Note: Currently, these vectors are not sorted and …

c++ stdvector
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
Correct way to work with vector of arrays

Could someone tell what is the correct way to work with a vector of arrays? I declared a vector of …

c++ arrays vector stdvector
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