0
Why doesn’t output vd2?
2 odpowiedzi
+ 1
Because "vd2" has no initial size, there are no elements inside, and you can't assign values to nonexisting elements.
Depending on what you want, you can either
a) construct "vd2" with "vd" as its argument, which results in "vd2" becoming a copy of "vd", or
b) use the std::vector member function "push_back()" instead of assigning a value.
The reference, just in case:
http://www.cplusplus.com/reference/vector/vector/
+ 1
Shadow, thanks!