example4_binding_prvalues_to_const_references.cpp

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

void print(const int& x) {
    std::cout << "Value: " << x << std::endl;
}

int main() {
    print(100);  // 100 is a prvalue

    return 0;
}
Back to prvalue