Boost logo

Boost :

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
you to
> 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:
once you
> 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
used as
> a 'visitor'.

This is terribly non-scalable.


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