Top "Stdvector" questions

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

Matlab API reading .mat file from c++, using STL container

I have to read some .mat data files from c++, I read through the documentation, but I would like to …

c++ matlab stdvector mex mat-file
std::vector of std::vectors contiguity

I know that std::vector<T> internally stores it's data contiguously (unless it is std::vector<bool&…

c++ vector stdvector
std::vector vs std::stack

What is the difference between std::vector and std::stack? Obviously vectors can delete items within the collection (albeit much …

c++ stl stack stdvector
How to get a pointer to last inserted element of a std::vector?

I came up with the following snipped but it looks quite hacky. vector<int> collection; collection.push_back(42); …

c++ pointers std stdvector push-back
'std::vector<T>::iterator it;' doesn't compile

I've got this function: template<typename T> void Inventory::insertItem(std::vector<T>& v, const …

c++ stdvector
push_back or emplace_back with std::make_unique

Based on the answers in these questions here, I know that it is certainly preferred to use c++14's std::…

c++ c++11 stdvector c++14 unique-ptr
C++: vector<string> *args = new vector<string>(); causes SIGABRT

Pretty self explanatory. Here's the method that's causing the SIGABRT on the 'new vector' line: vector<string> * Task::…

c++ new-operator stdvector sigabrt
Using std::vector as view on to raw memory

I'm using a external library which at some point gives me a raw pointer to an array of integers and …

c++ c++11 vector stdvector
How do I reserve memory for a std::vector at construction time?

Normally I call reserve on a std::vector immediately after constructing it. Wouldn't this typically cause the std::vector's existing …

c++ stdvector
Java 8 times faster with arrays than std::vector in C++. What did I do wrong?

I have the following Java code with several big arrays which never change their size. It runs in 1100 ms on …

java c++ arrays performance stdvector