[mpl] Determining when a type is a placeholder expression

Is there any way to determine when a type is an MPL placeholder expression ? I can determine whether a type is a metafunction class ( it has a class template called 'apply' ), but I can't think of any sure way to determine whether or not a type is a placeholder expression. Ideally if a type in one of my templates is an MPL lambda expression ( its either a metafunction class or placeholder expression ) I want to invoke it with some compile-time data, otherwise I want to do something else with that type. Of course a less elegant solution is to have another template boost::mpl::bool_ parameter telling which it is but I was hoping to avoid it if I can figure it out myself.

AMDG On 11/29/2012 08:18 PM, Edward Diener wrote:
Is there any way to determine when a type is an MPL placeholder expression ?
I can determine whether a type is a metafunction class ( it has a class template called 'apply' ), but I can't think of any sure way to determine whether or not a type is a placeholder expression.
Hmmm. Does template<class T> struct is_placeholder_expr : mpl::not_<is_same<typename mpl::lambda<T>::type, T> > {}; work?
Ideally if a type in one of my templates is an MPL lambda expression ( its either a metafunction class or placeholder expression ) I want to invoke it with some compile-time data, otherwise I want to do something else with that type.
Of course a less elegant solution is to have another template boost::mpl::bool_ parameter telling which it is but I was hoping to avoid it if I can figure it out myself.
In Christ, Steven Watanabe
participants (2)
-
Edward Diener
-
Steven Watanabe