Advertisement
haykart

Untitled

Oct 8th, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. Vector v1 = {1,2,3,4,5}; // v1 has 5 elements
  2. Vector v2 = {1.23, 3.45, 6.7, 8}; // v2 has 4 elements
  3. Vector’s initializer-list constructor might be defined like this:
  4. Vector::Vector(std::initializ er_list<double> lst) // initialize with a list
  5.      :elem{new double[lst.siz e()]}, sz{lst.siz e()}
  6. {
  7.      copy(lst.begin(),lst.end(),elem); // copy from lst into elem
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement