C++ Logo

std-proposals

Advanced search

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

From: Bo Persson <bo_at_[hidden]>
Date: Tue, 3 May 2022 16:37:46 +0200
On 2022-05-03 at 14:00, Tatsuya Yanagita via Std-Proposals wrote:
> Is explicit exactly same as =delete?
> I think they get different results with a brace initializer:
>
> void f(int);
> void f(auto) = delete;
>
> void g(explicit int);
>
> int main() {
> f({}); // OK
> g({}); // ERROR
> g(int{}); // OK
> }
>

The claim was "But learning it, & understanding it takes 30 sec."

So maybe it takes longer (at least for me)?


> 2022年5月3日(火) 18:42 Bo Persson via Std-Proposals
> <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>:
>
> On 2022-05-03 at 09:23, Abdullah Qasim via Std-Proposals wrote:
> > But learning it, & understanding it takes 30 sec.
> >
> > Instead of:
> >
> > “What are these functions deleted?”
> >
> > Why not:
> > “Oh, ok, these are explicit types!”
>
>
> So then we have to wonder "this library has deleted member functions,
> but that library uses explicit types. Why did they do that? What is the
> difference? None?!".
>
>

Received on 2022-05-03 14:37:55