$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] [Variant] Sorting data out of a vector of variant
From: Oliver Rudolph (oliver.rudolph_at_[hidden])
Date: 2009-10-14 05:04:19
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