19 Nov
2014
19 Nov
'14
3:43 p.m.
Andrzej Krzemienski wrote:
2014-11-19 16:28 GMT+01:00 Krzysztof Czainski <1czajnik@gmail.com>:
And then, why wouldn't a straightforward solution work:
struct none_t {};
none_t const none = {}
I think it validates ODR, or doesn't it?
It does violate ODR at places (without any ill effects AFAIK). Bind's placeholders have the same problem. One option is to use struct none_rt {}; typedef none_rt (*none_t)(); inline none_rt none() { return none_rt(); } Another is to declare none as constexpr: struct none_t {}; constexpr none_t none = {};