'How to understand the quotation about the member functions with ref-qualifiers?
As per the document , which says that
During overload resolution, non-static cv-qualified member function of class X is treated as a function that takes an implicit parameter of type lvalue reference to cv-qualified X if it has no ref-qualifiers or if it has the lvalue ref-qualifier. Otherwise (if it has rvalue ref-qualifier), it is treated as a function taking an implicit parameter of type rvalue reference to cv-qualified X.
Questions:
1.What about the member functions without any ref-qualifier? They would be treated as functions that implicitly declared with the lvalue ref-qualifier. Am I right?
2.Why it's limited to non-static cv-qualified member function(i.e. see the text in bold) other than non-static member function? What are the differences between them?
Solution 1:[1]
.What about the member functions without any ref-qualifier?
This has answer in the statement that you quoted. In particular(note the bold part in the quoted statement below),
During overload resolution, non-static cv-qualified member function of class X is treated as a function that takes an implicit parameter of type lvalue reference to cv-qualified X if it has no ref-qualifiers...
This means that for non-static const qualified member functions which are without any ref-qualifiers, during overload resolution they are treated as if they have an implicit object parameter of type const X&.
Why it's limited to non-static cv-qualified member function
It's limited to non-static member function because static member functions don't make use of this pointer. That is, they(static member functions) are not called on objects. In other words, they don't have a this pointer associated with them.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
