C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Review Request: Proposal Ternary Right Fold Expression (P1012)
From: Dvir Yitzchaki (dvirtz_at_[hidden])
Date: 2020-06-10 01:06:04


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
>



STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups