C++ Logo

std-proposals

Advanced search

Re: Review Request: Proposal Ternary Right Fold Expression (P1012)

From: Dvir Yitzchaki <dvirtz_at_[hidden]>
Date: Wed, 10 Jun 2020 09:06:04 +0300
you can get a similar behavior with operator||

```
template <std::size_t... is>
T test_impl(std::size_t j, std::index_sequence<is...>)
{
    T res;
    (void)( (j == is ? (res = f<is>(), true) : false) || ... || (throw
std::range_error("Out of range"), false) );
    return res;
}
```

https://gcc.godbolt.org/z/8mJ96z


On Mon, 8 Jun 2020 at 17:52, Frank Zingsheim via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Since the link to the github repository was broken into two lines, I
> repost the link again.
> I hope this time the link is formated into one line
>
>
> https://github.com/zingsheim/ProposalTernaryFold/blob/progress/ProposalTernaryFold.md
>
> Frank
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2020-06-10 01:09:23