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