
9 Dec
2005
9 Dec
'05
1:37 a.m.
Is it not possible to go for
typedef boost::array<const char*, size+1> array_type
?
Ah, yes, that's a terrific suggestion. Thanks. and maybe a CT version:
template< type index > inline const char* str() { BOOST_STATIC_ASSERT( index > Invalid ); return names[(int)index]; }
This is good too, but I think I'd still want a runtime version so that I can use it for an ostream operator. It seems a little weird to use: const char* str = Level::str<Level::Error>(); Hmm, wish it could look more elegant :p