12 Mar
2009
12 Mar
'09
1:16 a.m.
AMDG Claude Brisson wrote:
I need to enable only if a type T is among a specific known list.
I tried to build an operator is_one_of< T, list of known types > condition that could be used within an enable_if (like others type_traits operators), like this:
or< is_same< T, type1 >, or< is_same< T, type2>, ... >
so I searched for an or< condition1, condition2> construct and didn't find anything...
It's boost::mpl::or_ (Note that or is a keyword)
However, in this case, it's easier to use mpl::set:
#include
::type f(const T&) {}
int main() { f(1); // ok f("test"); // fails } In Christ, Steven Watanabe