Boost logo

Boost :

Subject: Re: [boost] Yap's formal review is starting now!
From: Zach Laine (whatwasthataddress_at_[hidden])
Date: 2018-02-16 00:45:38


On Thu, Feb 15, 2018 at 4:58 PM, Peter Dimov via Boost <
boost_at_[hidden]> wrote:

> Zach Laine wrote:
>
>> > Either way, that's up to the user, isn't it? If he wants to use >
>> std::tuple and index with `get(expr, mp_int<0>())` or `get_c<0>(expr)` >
>> instead of `get(expr, 0_c)`, let him.
>>
>> It could be, but that would be a much more complicated interface. As it
>> is, the user need only specify an expression kind non-type template
>> parameter and a Hana tuple to create a model of Expression.
>>
>
> The interface is not more complicated at all. The user just puts an
> std::tuple where he'd have put the hana::tuple. The implementation is more
> complicated. :-)

Well, mostly, but it's still user-visible. A transform might pattern match
against expressions like this:

struct my_xform {

    template<typename TerminalValue1, typename TerminalValue2>
    auto operator()(
        plus_tag,
        my_expr<expr_kind::terminal, TUPLE<TerminalValue1>> const & lhs,
        my_expr<expr_kind::terminal, TUPLE<TerminalValue2>> const & rhs)
    { return /*...*/; }

};

If TUPLE can be only std::tuple or hana::tuple, that's a lot easier to
write than if it can be any TupleLike.

Zach


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