Boost logo

Boost :

Subject: Re: [boost] "Simple C++11 metaprogramming"
From: Bruno Dutra (brunocodutra_at_[hidden])
Date: 2015-06-02 10:31:58

On Jun 2, 2015 11:09 AM, "Peter Dimov" <lists_at_[hidden]> wrote:
> Bruno Dutra wrote:
>> What you mean? std::decay<>::type is the lazy backend.
> Eh, no, it's just an implementation detail. Change your
> template<> struct test_c<void>{using type = void;};
> to
> template<> struct test_c<int>{using type = int;};

I'm sorry, I don't see why this is relevant, could you elaborate?

> and then look at the following decay<> of mine, which I'm sure you'll
agree really has no "lazy backend".
> template<class T> T make();
> template<class T> T decay_impl(T);
> template<class T> using decay = decltype(decay_impl(make<T&&>()));
> template<class T> using test2 = test<decay<T>>;

I agree that it does not have a "lazy backend" in the sense of my previous
replies, but I don't see your point, you've just switched to an equivalent
type dependent evaluation similar to what Hana does, but now at the expense
of not being able to even provide a lazy version to the end user in order
to allow for lazy branching, that is, you just made it crypt enough just so
you could call it "implementation detail".

All I'm trying to say is that laziness is required somehow under the hood
at some point and I don't see why hiding it from the end user if the effort
must be made to bring it about anyways. Keep in mind it is useful and very
much aligned to the current design of the standard C++ library and please
note I'm not even arguing in favor of lambdas and binding at this point.

Bruno Dutra

Boost list run by bdawes at, gregod at, cpdaniel at, john at