0

I was going through the link on reference qualified member function. My question is, if I have something like below:

struct S
{
    void f()
    {
        cout << "hello" << "\n";
    }
};

Now I can call function f like S().f(); Is it going to be treated as rvalue referenced? If I call same function like

S s;
s.f();

Is it going to be treated as lvalue referenced?

Cipher
  • 41
  • 2
  • 1
    From [the article](https://en.cppreference.com/w/cpp/language/member_functions#ref-qualified_member_functions) cited in the question you link to: "no ref-qualifier: the implicit object parameter has type lvalue reference to cv-qualified X and is additionally allowed to bind rvalue implied object argument". In any case, this only matters "during overload resolution", and in your example there's no overloading and so no overload resolution takes place. – Igor Tandetnik Dec 24 '21 at 04:42
  • @Igor Tandetnik. Thank you for your help and clearing my doubt. – Cipher Dec 24 '21 at 05:11

0 Answers0