I am learning the rvalue function in C ++ 11. C ++ Primer 5th edition says that the rvalue link can only be attached to the rvalue, but when I tried to compile this program, it passed and the output was 1 1 .
I do not understand why. I am using g ++ 4.4.6 and compiled it with
g ++ -Wall -std = C ++ 0x test.cpp -o test
#include <iostream> using namespace std; int main() { int i = 0; int &&rr = i; rr = 1; std::cout << rr << std::endl; std::cout << i << std::endl; return 0; }
c ++ c ++ 11 rvalue
stu_milano
source share