Boost logo

Boost :

Subject: Re: [boost] "Simple C++11 metaprogramming"
From: Peter Dimov (lists_at_[hidden])
Date: 2015-06-02 08:57:10


Bruno Dutra wrote:
> //traits example using a lazy backend
...
> template<typename _> using test = /*...*/
...
> template<template<typename...> class f, typename... args>
> using is_evaluable = /*...*/
>
> static_assert(is_evaluable<test, void>::value, "");
> static_assert(!is_evaluable<test, int>::value, "");
> static_assert(!is_evaluable<test, void, int>::value, "");

Where is the laziness here? The user sees test<> (an alias), is_evaluable<>
(an alias), and the static asserts don't refer to anything else.

If I add another metafunction (in my sense, i.e. a template alias)

template<class T> using test2 = test<std::decay_t<T>>;

that has no lazy test2_c backend, is_evaluable still works for it:

static_assert(is_evaluable<test2, void const volatile>::value, "");
static_assert(!is_evaluable<test2, int()>::value, "");
static_assert(!is_evaluable<test2, void, int>::value, "");


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