15 Oct
2004
15 Oct
'04
12:01 p.m.
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.