I found the following pattern in v8's source code:
// Superclass for classes only using static method functions.
// The subclass of AllStatic cannot be instantiated at all.
class AllStatic {
#ifdef DEBUG
public:
AllStatic() = delete;
#endif
};
Some questions:
1. why bother turning off the check when DEBUG
is not defined? seems the compilation time impact is just marginal. Any other reasons?
2. I tried using the pattern in my own project. Even when debug, I don't feel any benefit except for readability in some cases. What is this pattern mainly for?
Aucun commentaire:
Enregistrer un commentaire