From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-07-10 12:13:37
"Itay" <itay_maman_at_[hidden]> wrote in message
> a) Use a variant. It supports full value-semantics, but requires you
> explicitly state the set of acceptable types. This set is
> finitie so, theoretically speaking, you can replace any boost::any
> with a properly-parameterized variant object. In practice, this is
> always true since: (1) The set of types may be too large for your
> to handle. (2) Your program's dynamic nature makes it impossible for
> keep track of which types are assigned into your generic container,
> maintaining a centralized list of all of these types becomes too
> I think that (2) is the weaker argument of the two, due to this:
> convert your boost::any objects to variants any offending assignment
> trigger a compile-time error, so most of the work is carried out by
> compiler, for you.
This is wrong. The second argument is essential in any large program
developed and maintained by a team. Separate compilation is a need not
to be neglected.
> b) You can parametrize boost::any on a function object which will be
> a 'visitor'.
This is terribly non-scalable.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk