Boost logo

Boost :

Subject: Re: [boost] [any] Multimethod for boost::any and modified boost::any to fit multi method
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-02-13 10:00:32

Andrey Semashev wrote:
> Mathias Gaunard wrote:
>> A while ago, I offered something like this
>> any m = 0;
>> apply_visitor<int, double, A>(f, m);
>> or alternatively,
>> apply_visitor(f, m); with f specifying all overloads in some
>> compile-time reflection structure.
>> unfortunately, it cannot be made constant-time because std::type_info
>> sucks.
> FWIW, I would be really interested in this feature even if it's not
> constant time. May I hope it will appear in trunk one day?

It can actually be made constant-time using the result of
std::type_info::name for dispatching.
That means, however, that you need to know as a compile-time string the
names of the types to check for, and have implemented a compile-time
name mangling algorithm (which is of course platform-specific).

Boost list run by bdawes at, gregod at, cpdaniel at, john at