Boost logo

Boost Users :

Subject: [Boost-users] [MPL]...if_ and enable_if
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2012-03-09 10:04:47

I'm having a bit of punt into the murky world of metaprogramming, so this
might be a bit naive...!

I've been using Boost.enable_if for a while, and now I've just encountered
and wonder if enable_if is simply a special case of MPL.if_.


struct empty { };
template <typename T> struct my_condition : /* boost true_ or false_ */;


template <typename T> typename enable_if<my_condition<T>, int>::type f( ) {
/* .... */ }

the same as

template <typename T> typename eval_if<my_condition<T>, identity<int>,
empty>::type f( ) { /* ... */ }

Or is there some subtlety I'm missing (which is quite likely!)


- Rob.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at