|
Boost : |
Subject: Re: [boost] proposal for metafunction mpl::eval
From: klaus triendl (klaus_at_[hidden])
Date: 2013-09-11 17:25:42
Am Wed, 11 Sep 2013 21:32:00 +0100
schrieb Jonathan Wakely <jwakely.boost_at_[hidden]>:
> On 11 September 2013 21:26, klaus triendl wrote:
> > Hi,
> >
> > I'm not so much into meta-programming, so I'm not sure whether
> > there's already an alternative available.
> >
> > Nevertheless I'd like to propose a new metafunction that simply
> > evaluates its argument:
> >
> > template<typename F>
> > struct eval: F::type
> > {};
>
> You can only derive from class types, so this can't be used with
> metafunctions returning scalar types, references, pointers, arrays, or
> functions.
I'm aware of this, however the implementation could be different:
template<typename F>
struct eval
{
typedef typename F::type type;
}
It's similar to eval_if with respect to evaluation.
> C++11 provides what you want:
>
> template<typename F>
> using eval = typename F::type;
That's cool :)
It would be interesting of course to have it available in the mpl
library...
-- klaus triendl
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk