Are there cases where a typedef is absolutely necessary?

后端 未结 8 1166
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-05 01:21

Consider the following excerpt from the safe bool idiom:

typedef void (Testable::*bool_type)() const;
operator bool_type() const;

Is it possibl

8条回答
  •  长发绾君心
    2021-02-05 01:49

    In C++11, you can do it like this (gcc 4.5.2):

    operator decltype((void (Testable::*)() const)(0))() const ;
    

    I'm not saying it's pretty...

提交回复
热议问题