Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-10-15 07:01:59


Frank Birbacher wrote:
> Hello!
>
> I like the idea of containers (e.g. std::vector) of boost::any.
> But I'd like to execute some operation on each item of the
> sequence. Unfortenuately I would need to know the set of types in
> the container and check every one of them if I was going to use
> the std::for_each with a void(*)(boost::any&). That's not good at
> all. I'd like to pass a function object like:
>
> struct MyOperation
> {
> template<typename T>
> void operator() (T&) const;
> };
>
> How can I do so?

Not with boost::any, but you can do the above with boost::variant.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net