Am Wed, 11 Sep 2013 21:32:00 +0100
schrieb Jonathan Wakely
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