C++ Logo

std-proposals

Advanced search

Re: std::as

From: Miguel Ojeda <miguel.ojeda.sandonis_at_[hidden]>
Date: Tue, 27 Oct 2020 23:55:20 +0100
On Tue, Oct 27, 2020 at 4:43 PM Jason McKesson via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> But isn't that what `get_if` does already? It is a simple API, and a
> proper one. It reflects the intent of the writer. It's not an idiom;
> it's how you get a value from a `variant`.

No, it doesn't reflect the intent. `get_if` means you don't know
whether it matches.

> As it stands, we have two ways to extract a value from a variant. I
> don't believe we need *three* ways to do it.

They are different use cases.

Cheers,
Miguel

Received on 2020-10-27 17:55:33