vendredi 3 mars 2017

Why are constructors not allowed to be ref-qualified?

Is there a particular reason why constructors cannot be ref-qualified? This code will not compile:

class MyClass {
  public:
    MyClass() && {}
};

int main() {
    const auto obj = MyClass();
}

error: constructors may not be ref-qualified

Aucun commentaire:

Enregistrer un commentaire