example4_rvalues_from_expressions.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <iostream>

int add(int x, int y) {
    return x + y;  // The result of 'x + y' is an rvalue
}

int main() {
    int result = add(5, 10);  // 'add(5, 10)' is an rvalue

    std::cout << "result: " << result << std::endl;

    return 0;
}
Back to rvalue