Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-07-10 14:14:47

"Mac Murrett" <mmurrett_at_[hidden]> wrote in message
> I thought that the purpose of a variant class was to overcome the
> shortcomings of boost::any. A variant whose type is restricted to
> those in a type list would benefit from this visitor. A variant
> that can hold any type, such as boost::any, would not. This is
> because by the time something is in a boost::any, the compiler has
> lost track of what the real type is. Using type lists, we can
> create a variant that can represent an instance of any type in the
> type list, and have the compiler dispatch visitation (among other
> things).

Without having examined the code, if I understand the above (and the
snipped-out part as well), I'd say the it is true and accurate. With
boost::any, acyclic visitor is best to use. With Variant, the acyclic
visitor has an advantage that is futile. So why not use the "cyclic"
GoF Visitor which has better speed and tighter error handling.


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