vendredi 3 février 2017

return type of deleted functions in c++11

In c++ 11, we could disable copy constructor and assignment operator, with delete:

class A {
  A(const A&) = delete;
  A& operator=(const A&) = delete;
}

One day, my colleague use the void return type rather than the reference.

class A {
  A(const A&) = delete;
  void operator=(const A&) = delete;
}

Is this one also ok?

e.g., if i have

A a, b, c;
a = b = c;

will this work?

Aucun commentaire:

Enregistrer un commentaire