Boost logo

Boost :

From: Itay Maman (itay_maman_at_[hidden])
Date: 2003-02-18 14:49:54


"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 template
(2) boost::any offers a query-based mechanism for accessing its held value:
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 variant's


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