Question 9
Back to Exercise
Why write std::copy(a.begin(), a.end(), std::back_inserter(b))?
- A To copy backwards
- B So each copied element is appended with push_back, growing b as needed Correct
- C To reverse a
- D For speed only
Correct Answer: Option B
Copying to b.begin() of an empty b would write past its end.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!