19 Nov
2014
19 Nov
'14
4:07 p.m.
Andrzej Krzemienski wrote:
One option is to use
struct none_rt {};
typedef none_rt (*none_t)();
inline none_rt none() { return none_rt(); }
Not an option. According to GCC, the following compiles:
void d(none_t) {} int main() { d(0); }
Right, sorry, I forgot. You can make that typedef none_rt (&none_t)(); and it will reject 0, but then 'none' will not pass through template parameters. void d( none_t ) {} template< class T > void e( T t ) { d( t ); } int main() { e( none ); } Not sure if you need that, but you probably do.