C++ Logo

std-proposals

Advanced search

Re: [std-proposals] inplace_vector failable apis

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Mon, 20 Nov 2023 19:11:42 +0100
pon., 20 lis 2023 o 17:21 Jonathan Wakely via Std-Proposals
<std-proposals_at_[hidden]> napisaƂ(a):
>
>
>
> On Mon, 20 Nov 2023 at 00:32, Magnus Fromreide via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>
>> 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
>
>
> That would look pretty silly if we get std::optional<T&> in C++26. Working around the absence of optional<T&> like this would be a pretty ugly kluge.
>
> If we do get optional<T&>, I think it would be reasonable to ask why it's not used there.
>

I heard couple problems with the design of this optional,
as there are two competing approaches to how it should work.
Question is why then does the standard avoid some of this problems
and have for example `optional_ref<T>`?

>
>>
>> std::expected<std::reference_wrapper<T>, void>
>
>
> The error_type of std::expected can't be void.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-11-20 18:11:54