From the course: Modern C++: Advanced Techniques and Features
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Understanding value categories - C++ Tutorial
From the course: Modern C++: Advanced Techniques and Features
Understanding value categories
- In this section, we're going to take a look at value categories. This is the term used in C++ to represent, well, what we used to call lvalues and rvalues is now become a whole load more complicated in modern C++. We have other terms like xvalues and prvalues and glvalues. So, generally, the kind of variable you've got, they're called value categories. So, we'll have a look at how value categories used to work before C++11. It all changed in C++11. Then, we'll see how value categories work now. The main point is it's all about rvalue references, a reference to an rvalue. Okay, so we'll introduce the concept of rvalue references and talk about why they're useful, and then we'll go into it in more detail later on in this lesson. So, before C++11, life was easy. We had basically lvalues or rvalues. Traditionally named, an lvalue could go on the left-hand side of an assignment, and an rvalue could only go on the right-hand side of an assignment. So, let's take a look at both of those…