as the title is pretty explanatory, how is the best way to iterate over a boost::variant, std::vector> variable?
Say that I have a structure:
struct foobar{
enum typeOfVariant {intVariant, StringVariant}
boost::variant<std::vector<int>, std::vector<String>> variable;
}
That i receive at a certain point with the guarantee that the enum is corelated with the type from the variant.
To achieve maybe something like: boost::variant, std::vector> var;
for (auto t in var)
{
//do something
}
^this might be the ideal way.
Or to force conversion to a std::vector or std::vector, based on the enum type?
Aucun commentaire:
Enregistrer un commentaire