Boost logo

Boost :

From: Manfred Doudar (manfred.doudar_at_[hidden])
Date: 2005-09-15 05:03:12

Stephen Gross wrote:

>I've put together a class called 'AnyVector' for doing type-based iteration
>on a vector. The basic idea is that AnyVector wraps a
>std::vector<boost::any>. The AnyVector lets you iterate across a subset of
>the underlying vector by using filter_iterators. The filter iterators, in
>turn, dereference to the requested type for ease of use. For instance, you
>can do the following:

I've done something similar to this in the past, but found it notoriously
slow to filter on types with boost::any - (on top of this I also added the
capability to cast into another type, and throw if it was not possible).

Not to disuade you, however, I would really be interested to know if you've
profiled your code for a mix of types (say 10 or more atomic types).
my experience with this sort of thing meant runtimes suffered.

><snip .. example code>


Manfred Doudar
MetOcean Engineers

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