What is the generator argument in std::copy()? I dont understand what an output iterator is in this context. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the generator argument in std::copy()? I dont understand what an output iterator is in this context.

std::copy(inputIt it.begin(), inputIt it.end(), outputIt oIt???); I don't understand what it's asking.

4th Nov 2018, 1:03 AM
Brandon Autry
Brandon Autry - avatar
2 Answers
+ 3
You have to show where you want to copy your values. vector<int> a, b; std::copy(a.begin(), a.end(), b.begin()); In above example values from vector "a", should be copied to vector "b".
4th Nov 2018, 1:47 AM
Jakub Stasiak
Jakub Stasiak - avatar
+ 1
what if it's a mulitset? how would I copy it in then?
4th Nov 2018, 2:41 AM
Brandon Autry
Brandon Autry - avatar