C++ Logo

std-proposals

Advanced search

Re: [std-proposals] explicit keyword (new use)

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Tue, 3 May 2022 19:16:15 +0300
On Tue, 3 May 2022 at 18:18, Giuseppe D'Angelo via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> On 03/05/2022 16:37, Bo Persson via Std-Proposals wrote:
> > The claim was "But learning it, & understanding it takes 30 sec."
> >
> > So maybe it takes longer (at least for me)?
>
> But learning *what* precisely? What does f(explicit X) accept?
>
> 1) only and precisely X

void f(std::same_as<X> auto); // like this ?

> 2) things implicitly convertible to X

void f(std::convertible_to<X> auto); // like this?

We already have the language facility that allows us to declare one
function (template) that accepts arguments of exactly the
type of the parameter, and no implicit conversions are performed.

Received on 2022-05-03 16:16:27