mercredi 26 août 2015

Do compilers provide default move assignment operators and move constructors?

Do compilers (let us use g++ as the specific example) provide a default move constructor and default move assignment operator when we write a class?

Compilers provide a default:

  • Constructor (no arguments) unless another constructor with arguments which is not a copy constructor is declared.
  • Destructor (which presumably does nothing? - actually not quite, this question has an answer here, it calls the base class destructor)
  • Copy Constructor unless we write our own
  • Copy Assignment Operator unless we write our own

Will a compiler provide a default move constructor or move assignment operator.

Aucun commentaire:

Enregistrer un commentaire