Rvalue and Forwarding References¶
Consider the following data and function declarations:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
The table below combines various functions and arguments into function calls. Expressions in light-blue are valid in both C and C++, whereas expressions in cyan have new meaning since C++11.
Fill out each table cell for each combination what should happen: should the compiler issue an Error? should the expression be allowed (OK)? Should the expression create an extra Copy? Why do you think so?
You may consult with the compiler: for example, the cell at row &d and column ptr(data*); is OK, because the expression ptr(&d) compiles fine.

Last update:
June 10, 2021