Boost logo

Boost :

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


On Fri, Feb 16, 2018 at 10:22 AM, Peter Dimov via Boost <
boost_at_[hidden]> wrote:

> Steven Watanabe wrote:
>
> The thing is, in most cases, the tuple type is chosen by Yap, not by the
>> user. Most of the time, users don't actually need to care what the tuple
>> type is, either.
>>
>
> ...
>
> struct a_transform {
>> template<class T>
>> auto operator()(terminal_tag, T&&t);
>> // ...
>> };
>>
>
> Right.
>
> I'd guess that tag matching is a later addition, because it only works for
> simple cases. You can't do
>
> auto operator()(any_expression_tag, T&&... t);
>

I'm don't understand what that would mean, exactly. What you can write
though is:

template <typename Tag, typename... T>
auto operator()(Tag, T &&... t)

Is that different from the intended use case above?

[snip]

template<expr_kind kind, class... T>
> auto get_arity::operator()(expression_tag<kind>, T const&... t) const
> {
> return std::max( { yap::transform(t, get_arity{})... } );
>
> }
>

I'm pretty sure you actually can write almost exactly this using the
template I showed above. I'll verify that this is the case. That might
make the example a lot easier to understand.

Zach


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