From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2008-03-28 18:21:30
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 = ....;
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...
...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).
-- ...ich hab' noch einen Koffer in Berlin...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk