samedi 25 avril 2020

C++ Why should each function have a reference qualifier when defining overloads and reference functions

I can't understand :Why if a member function has a reference qualifier, all versions with the same list must have a reference qualifier. Is it because multiple definitions are created when this function is called?

class A{
   public:
         A sorter() &&;
         A sorter();
         A operator+ (const A&);
       }

Although there is only function declaration above, it should be enough

A a , b;
(a+b).sorter();

Does the definition and calling of a function like the above make the compiler unable to recognize which member function to use?

Aucun commentaire:

Enregistrer un commentaire