
1 Sep
2013
1 Sep
'13
11:52 a.m.
On Sunday 01 September 2013 07:46:40 John Bytheway wrote:
But this works:
struct foo { void* m_p;
constexpr explicit operator bool () const { return !this->operator!(); }
constexpr bool operator! () const { return !m_p; } };
int main() { constexpr auto f = foo{nullptr}; constexpr auto b = bool(f); return b; }
That would force the user to have constexpr operator!, which is not always possible. I think two macros are a better choice.