This is an idea that has been roaming around my head for some 20 years!

 

As we know, there is a list of some 15 (or so) operations (construction, assignment, copy, move, conversion, etc.) that the simple statement: “class T {};” defines.

 

If one wishes some control over this behavior, one has to be knowledgeable in all that the compiler provides.  In non-C++ terms, one has to say (modern use: =delete), “I don’t want that, I don’t want this, etc.”  The compiler provides no aid for this!

 

My notion is to reverse this via “explicit class T {};”.  While I am sure there are some details that would need to be debated, this would eliminate (most) everything that the compiler defines for you.  Thus, if you wanted something, you would have to define it or use “ = default” (yes, I am aware that would require extending “= default” to more items – seems OK to me).  The obvious advantage is that the compiler now provides some help, in that using something that is not defined will yield a compiler error.

 

Does anyone know if this has been proposed before?  If not, what do you think?

 

Thanks in advance!