C++ Logo

std-proposals

Advanced search

Re: std::as

From: Emile Cormier <emile.cormier.jr_at_[hidden]>
Date: Wed, 28 Oct 2020 17:10:18 -0300
Date: Mon, 26 Oct 2020 15:17:57 -0400
> From: "Arthur O'Dwyer"

But then your `std::as` proposal still has two problems that need solving
> via bikeshedding:
> - You cannot use the name `as` because it's too short; I guarantee
> somebody
> out there has a list of A objects named `as` (and is also `using namespace
> std`).
> - You should not use the name `as` because it's literally shorter than the
> "checked" version `std::get`. The "unsafe" version should be something
> long
> and scary-looking, that newbies can't start using by accident.


 How about std::alternative<T>, which matches up nicely with
std::variant::holds_alternative<T> ?

Received on 2020-10-28 15:10:31