Modern C++ Overview
Part Three Exercises
Copyright © James Raynard 2023
lvalue and rvalue
• Explain briefly what is meant by the terms "lvalue" and "rvalue" in
C++
• Give some examples
Copyright © James Raynard 2023
lvalue and rvalue references
• Explain briefly what is meant by the terms "lvalue reference" and
"rvalue reference"
Copyright © James Raynard 2023
Rvalue reference
• Write a function which has an rvalue reference as argument
• Write a program which calls this function, passing an rvalue to it
• Alter your program so that it passes an lvalue to it
• Explain your results
Copyright © James Raynard 2023
std::move
• Modify your program from the previous slide so that it works when
passing an lvalue
• What implications does this have?
Copyright © James Raynard 2023