views:

71

answers:

1
+4  A: 

It is indeed possible, Variant::types meets the requirement of a Mpl.Sequence type and therefore can be queried like any sequence.

Therefore, using boost::mpl::contains from here:

// using C++0x syntax to demonstrate what CONDITION should be replaced with
template <typename T>
using Condition = boost::mpl::contains<Variant::types,T>

Nothing simpler, when you know about it ;)

The full MPL Manual is available in HTML format, should you need some more algorithms.

Matthieu M.
+1. Since the question is tagged C++ and not C++0x, you might want to add a comment about your `using` syntax. Also, didn't you mean to write `Variant::types` instead of `Variant` in `boost::mpl::contains` ?
sellibitze
@sellibitze: thanks for scrutifying the code :-)
Matthieu M.