If I want to output a container's values faster, which output method should i use? ostream_iterator
or cout
?
For example:
vector<int>primes{2,3,5,7,11};
Case 1:
ostream_iterator<int>out{cout," "};
copy(begin(primes),end(primes),out);
Case 2:
for(int i{};i<primes.size();i++)
cout << primes[i] << " ";
Aucun commentaire:
Enregistrer un commentaire