1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <utility> // For std::move
int main() {
int a = 42;
int&& r = std::move(a); // 'std::move(a)' produces an xvalue
r = 100; // Modifying the xvalue 'r'
std::cout << "a: " << a << std::endl; // 'a' may be in an unspecified state
std::cout << "r: " << r << std::endl;
//GE std::cout << &a << std::endl; // 'a' may be in an unspecified state
//GE std::cout << &r << std::endl;
return 0;
}
Back to xvalue