Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (14 sloc) 411 Bytes
#include <algorithm>
#include <iostream>
#include <vector>
int main(void) {
int list[] = { 1, 2, 3, 4, 5, 6, 7 };
std::vector<int> v;
v.resize(7); // Allocate space for 7 elements.
std::copy(list, list + 7, v.begin());
std::cout << "The vector elements are:";
for (std::vector<int>::iterator i(v.begin()); i != v.end(); ++i)
std::cout << " " << *i;
std::cout << std::endl;
return 0;
}