Talk:cpp/container/vector
From cppreference.com
--BohdanKornienko (talk) 13:23, 16 October 2013 (PDT)
Small example to use vector header:
- include <iostream>
- include <vector>
int main(int argc, char **argv) {
std::vector<int> vec;
vec.insert(vec.begin(), 1); vec.insert(vec.end(), 2); vec.insert(vec.end(), 3);
vec.erase(vec.begin() + 1);
std::cout << "count: " << vec.size() << "\ncapacity: " << vec.capacity() << std::endl;
return 0;
}