Boost logo

Boost :

Subject: Re: [boost] [mpl] Determining when a type is a placeholder expression
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-11-30 01:08:25


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk