1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
#include <iostream>
#include <vector>
int main()
{
std::vector<int> first(10, 42); //uses fill constructor
std::vector<int> second(first.begin(), first.end()); //uses range constructor
std::vector<int> third(second); //uses copy constructor
std::vector<int> fourth{42, 42, 42, 42, 42, 42, 42, 42, 42, 42};
int *pFirst, *pSecond;
pFirst = &first[0];
pSecond = &first[9];
std::vector<int> fifth(pFirst, pSecond); //another use of the range constructor
std::cin.ignore();
return 0;
}
|