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 13:01:41


On Wednesday, 22 July 2020 10:50:52 PDT Scott Michaud via Std-Proposals wrote:
> Any thoughts on where else this could be used?

Call the explicit vec.reserve() function instead. There's no ambiguity in what
it does.

I don't think we need more short-hands. Constructors should be reserved for
the few needs where multiple lines would not do. Here's a litmus test: does it
make sense to pass an object created with *just* that constructor to a
function, either by value or by const-reference?

func({1, 2, 3}); // certainly does
func(reservation_t{12}); // ???

This is not an absolute rule, of course. But it serves as a good indicator.

-- 
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