I found the following class 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(i.e. derive my pure utility class from AllStatic) 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?
Edit: clarity what is the "pattern" in my question.