
14 Oct
2009
14 Oct
'09
9:04 a.m.
Hi all! I have some class with a member which is a vector of boost.variant, i.e. class Example { public: std::vector<variant<typeA, typeB, typeC> > content; } I want to add three members to my class that are vectors of pointers to the specific content items class Example { public: std::vector<variant<typeA, typeB, typeC> > content; std::vector<typeA> *contentA; std::vector<typeB> *contentB; std::vector<typeC> *contentC; } Now the question: how can I iterate through the vector content whilst adding its items to the other 3 vectors depending on their type? I know there has to be some way using the apply_visitor functor, but I just don't see how exactly... Thanks for your help! Best regards, Oli