Boost logo

Boost :

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


Bruno Dutra wrote:
> I agree that it does not have a "lazy backend" in the sense of my previous
> replies, but I don't see your point, ...

My point is that is_evaluable works on metafunctions regardless of whether
they have lazy backends or not. You were citing is_evaluable as a motivating
example that lazy backends are necessary, but it doesn't need them.

I do agree that for branching one does need laziness. So if you want, f.ex.

template<class Def, template<class...> class F, class... T>
using eval_or_default = /**/
// if is_evaluable<F, T...> returns F<T...> else returns Def

then I agree that you have to have a lazy if.

My basic question is "do you need laziness for something else apart from
lazy if?"

> ...but now at the expense of not being able to even provide a lazy version
> to the end user...

The lazy version is not hard to recover, but I'm still wondering whether
it's even necessary outside of if.

template<template<class...> class F, class... T> struct mp_defer
{
    using type = F<T...>;
};


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