C++ Logo

std-proposals

Advanced search

Re: [std-proposals] inplace_vector failable apis

From: Magnus Fromreide <magfr_at_[hidden]>
Date: Mon, 20 Nov 2023 09:34:35 +0100
On Mon, Nov 20, 2023 at 11:05:56AM +0400, Nikl Kelbon wrote:
> Because pointer IS a optional reference by semantic

I would like to note that I disagree with this statement, an optional or
expected provides additional interfaces as well as more information about
the intent behind an interface than a raw pointer does.

This is very similar to iterators where T* models the iterator concept but
many implementations still provide iterator objects.

/MF

> пн, 20 нояб. 2023 г. в 04:32, Magnus Fromreide via Std-Proposals <
> std-proposals_at_[hidden]>:
>
> > Hello!
> >
> > When I saw the failable API's the first question I asked myself was why you
> > choose to use T* as return type rather than
> > std::optional<std::reference_wrapper<T>> or possibly
> > std::expected<std::reference_wrapper<T>, void>
> >
> > /MF

Received on 2023-11-20 08:34:38