I understand the following code, but just wondering what is the benefit of such a feature? I understand the performance benefit of a function argument taking a && - r-value reference instead of an l-value, but don't get the following case where the function being called is decided based on whether the object is r-value reference or l-value.
#include <iostream>
class SomeClass {
public:
int f() & { std::cout << "lvalue\n"; }
int f() && { std::cout << "rvalue\n"; }
};
int main() {
SomeClass s; s.f(); // prints "lvalue"
SomeClass{}.f(); // prints "rvalue"
}