C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Request for opinion: Leaning on strong typing in STL.
From: Thiago Macieira (thiago_at_[hidden])
Date: 2020-07-22 22:16:43


On Wednesday, 22 July 2020 17:20:36 PDT Arthur O'Dwyer via Std-Proposals
wrote:
> Presumably Scott's proposed `vector(reservation_t)` constructor would be
> marked `explicit`, to turn off that implicit conversion. Implicit
> conversions are the devil.

Sorry, I didn't mean that the implicit was the issue. My argument is that a
reserved but empty vector is has no purpose as a function argument.

        func(vector<T>(reservation_t(12)));

I could see use for this as an NSDMI, but what if I want to reserve and add
one element? We need a (rough) rule on what makes sense to have a constructor
for.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DPG Cloud Engineering

STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups