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