C++ Logo

std-proposals

Advanced search

Re: [std-proposals] inplace_vector failable apis

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Mon, 20 Nov 2023 16:21:03 +0000
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.



> std::expected<std::reference_wrapper<T>, void>
>

The error_type of std::expected can't be void.

Received on 2023-11-20 16:21:19