Enclosing vector in initialiser lists calls l-value or r-value overload? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Enclosing vector in initialiser lists calls l-value or r-value overload?

Could someone please explain why the following code, specifically, the three calls to the print function overloads, results in either the l-value or r-value overloads being called when enclosing the vector argument in 0, 1, or 2 sets of curly braces? https://www.sololearn.com/compiler-playground/cv89oD5cX3Zq

18th Mar 2023, 10:52 AM
Edward Finkelstein
Edward Finkelstein - avatar
1 Answer
+ 1
https://stackoverflow.com/questions/75115213/does-wrapping-an-lvalue-in-double-curly-braces-create-a-temporary-object-that-ca
18th Mar 2023, 3:22 PM
MO ELomari