
1 Sep
2013
1 Sep
'13
5:11 p.m.
On Sunday 01 September 2013 15:52:53 you wrote:
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.
Extracted the macro. https://svn.boost.org/trac/boost/changeset/85543