doubt about functions that receive a rvalue reference as argument

0

Someone can explain to me with a short example what is marked in bold

The compiler treats a named R-value reference as an L value and an unnamed R-value reference as an R value. When you write a function that accepts a reference of value R as a parameter, that parameter is treated as a value L in the body of the function. The compiler treats a named R value reference as an L value because a named object can be referenced in various parts of a program; It would be dangerous to allow several parts of a program to modify or remove resources from that object. For example, if several parts of a program try to transfer resources from the same object, only the first part will transfer the resource correctly .

    
asked by Jcpardo 27.05.2018 в 00:52
source

0 answers