Date: Wed, 11 Sep 2024 12:46:50 -0500
On Wed, Sep 11, 2024, 11:56 AM Corentin Adam via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> Hi everyone,
>
> I've recently been working on a cpp implementation of the rust collect
> function: :
> https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect.
>
> This function has two main uses in rust:
> * construct containers from ranges (exactly the work achieved by
> std::ranges::to)
> * collect ranges of expected/optional values into expected/optional range
> of value. Thus, if all values in the range are correct (in other words
> has_value() == true), the return value is true and contains the range of
> underlying values. Otherwise, the return value contains the first error
> encountered in the range.
>
ranges::to can support the second use-case as well. We just need to add the
appropriate constructor to optional and expected.
Barry
>
std-proposals_at_[hidden]> wrote:
> Hi everyone,
>
> I've recently been working on a cpp implementation of the rust collect
> function: :
> https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect.
>
> This function has two main uses in rust:
> * construct containers from ranges (exactly the work achieved by
> std::ranges::to)
> * collect ranges of expected/optional values into expected/optional range
> of value. Thus, if all values in the range are correct (in other words
> has_value() == true), the return value is true and contains the range of
> underlying values. Otherwise, the return value contains the first error
> encountered in the range.
>
ranges::to can support the second use-case as well. We just need to add the
appropriate constructor to optional and expected.
Barry
>
Received on 2024-09-11 17:47:05