dimanche 28 décembre 2014

What's the difference between "doesn't synthesize" and "defined as deleted"?

I read C++ Primer 5th, and found move constructor and move assignment confusing.


On one page, it says:



The compiler synthesizes the move constructor and move assignment only if a class does not define any of its own copy-control members and only if all the data members can be moved constructed and move assigned, respectively.



On another page, it says:



If we explicitly ask the compiler to generate a move operation by using = default, and the compiler is unable to move all the members, then the move operation will be defined as deleted.



Is there any difference between "doesn't synthesize" and "will be defined as deleted"?


Aucun commentaire:

Enregistrer un commentaire