jeudi 30 juillet 2015

A const data member prevents automatic generation of both copy and move ctors?

Consider the following class:

struct A 
{ 
    int const x;
    A(int x) : x(x) { }  
}

Will this class get automatically generated move and copy ctors? Or is this prevented by the presence of the const field member x?

From my experience the answer is that move and copy ctors will not be generated, but I haven't found an explicit mention of this in the standard. Is there anything in the standard that implies that in this case the move and copy ctors are not generated?

Of course, the same questions apply to move/copy assignments.

Aucun commentaire:

Enregistrer un commentaire