Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-02-18 20:03:00

At 02:49 PM 2/18/2003, Itay Maman wrote:

>"Rodolfo Lima" <rodolfo_at_[hidden]> wrote in message
>> How different is boost::any from this new variant library? Don't they
>> address the same issue?
>In short:
>(1) boost::any can accept a value of any possible type. boost::variant
>accepts only values of a finite set of types, which are passed as
>(2) boost::any offers a query-based mechanism for accessing its held
>any_cast<T>(a); This operation may fail (at runtime). The equivalent
>facility of boost::variant is: apply_visitor(a_visitor, a_variant). This
>operation will fail at *compile-time* if a_visitor is not a valid visitor
>for a_variant. More details can about visitation can be found in

Note that the need to document the difference between boost::any and
boost::variant is common to both libraries.

Thus (assuming boost::variant is accepted) it would make sense to document
the difference in one place (presumably boost::variant) but then also add a
sentence with a link to the boost::any docs. Perhaps add that to your do


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