
Mathias Gaunard wrote:
Stefan Seefeld wrote:
I agree. And, some simpler templating techniques may be used to map the current helt type discriminator to the (C++) type, thus dispatching calls by other means than what is typically referred to as 'visitation'.
What techniques?
As I understand your request, you want to roll your own switch statement, but with more expressive values than simple numbers. In other words, you want a mapping from types to variant type discriminators: variant<A, B, C> v = ....; switch (v.which()) { case v::type_id<A>::value: break; case v::type_id<B>::value: break; } (there are certainly many ways to spell that 'type_id' map above, I just made this up to illustrate my point.)
(I still fail to appreciate the usefulness of those compile-time static strings. I find them rather ugly...)
If you want to compute something on a string at compile-time, you need a compile-time string.
Certainly. But I haven't seen any good example on *what* I may want to compute on a string at compile-time. To me... struct my_compile_time_string; ...makes 'my_compile_time_string' a very lean and easy-to-read compile-time string. And as far as I know it's in use in boost in a lot of places already (not the least to generate intelligible compiler error messages, triggered during template instantiations). Regards, Stefan -- ...ich hab' noch einen Koffer in Berlin...