#include#include using namespace std; using namespace experimental; void func(ERef ref) { cout << "Value is: " << ref << endl; } int main() { int x = 5; func(x); // pass lvalue reference func(ERef (6)); // pass rvalue reference return 0; }
#includeThe package library for ERef is the#include #include using namespace std; using namespace experimental; int main() { int x = 5; int y = 10; vector > vec; vec.push_back(x); // add lvalue reference vec.push_back(ERef (y)); // add rvalue reference for (const auto& ref : vec) { cout << "Value is: " << ref << endl; } return 0; }