2

This piece of code I came across really confuses me, it seems to make use of rvalue semantics in order to print a vector:

std::vector<int> b = {0,0,0,14,15,123,2431};
mergeAndSort(a,b);
for(auto&& i : b)
    std::cout << i << ' ';

but what is i set to? and why is an rvalue reference needed to loop through b?

Syntactic Fructose
  • 17,149
  • 19
  • 87
  • 170

0 Answers0