Consider the following excerpt from the safe bool idiom:
typedef void (Testable::*bool_type)() const;
operator bool_type() const;
Is it possible to declare the conversion function without the typedef? The following does not compile:
operator (void (Testable::*)() const)() const;
Ah, I just remembered the
identitymeta-function. It is possible to writewith the following definition of
identity:You could argue that
identitystill uses atypedef, but this solution is “good” enough for me.