Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2006-12-16 06:44:47

Joel de Guzman wrote:
> Now...
> std::for_each(x, f) // x is a variant
> std::for_each(y, f) // y is a variant

Darned. I meant a vector of variants of course ;-)

> in addition to what fusion does (zero overhead), the variant code
> will also have to emit some switch code to dispatch to the correct
> 'f' (visitor) overload.

Anyway, having said all that, vector of variants do have
their place. Its most important property is the ability to
dynamically resize the container. Fusion sequences will always
have fixed sizes. So, bottom line, use the right tool for the
job. Both have their place and comparing one to the other is
like comparing std::vector with boost::array. There's reason
for the existence of both.


Joel de Guzman

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