Boost logo

Boost :

Subject: Re: [boost] [Fit] pipable order of the arguments
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2016-03-05 07:00:29


Any feedback on this?

Le 06/10/2015 02:52, Vicente J. Botet Escriba a écrit :
> Hi,
>
> I would like to know what other think about the order of the pipe (See
> this issue https://github.com/pfultz2/Fit/issues/5).
>
>
> What would be the expected meaning of
>
> auto r1 =1 | pipable(f)(2);
>
> f(1,2) or f(2,1)?
>
>
> What would be the expected meaning of
>
> auto f2 = partial(f)(2);
>
> auto r1 =1 | pipable(f2);
>
> f(1,2) or f(2,1)?
>
>
> As the operator| has left-to-right associativity, we can not do
>
> auto x = 1 | 2 | pipable(f);
>
> We would need a way to pack the parameters
>
> auto x = forward_as_tuple(1, 2) | pipable(f);
>
>
> but this wouldn't compile as f has two parameters.
>
> or use parenthesis
>
> auto x = 1 | (2 | pipable(f));
>
> and the result will be f(2, 1).
>
>
> Any ideas?
>
> Best,
> Vicente


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