#include <iostream>
using namespace std;
int main() {
int &&rfint = 10;
int &l = rfint;
std::cout << l << std::endl;
std::cout << ++l << std::endl;
std::cout << &l << std::endl;
return 0;
}
Using the above construction, I can directly manipulate the value of prvalue 10using a non-const lvalue reference l. I can even go to the prvalue address. How it works? Does this have a long life span ?
source
share