C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Request for opinion: Leaning on strong typing in STL.
From: Olaf van der Spek (ml_at_[hidden])
Date: 2020-07-23 02:54:51


On Wed, Jul 22, 2020 at 7:51 PM Scott Michaud via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> Do the library maintainers have any established opinion about strongly typing parameters that can be ambiguous?
>
> I'll illustrate what I mean with a concrete use case: std::vector.
>
> In C++, there is a constructor that takes a single size_type and creates a vector with n default-constructed elements. I need to frequently bounce between languages, and other languages (such as Java and C#) have their analogous constructor initialize the capacity without creating initial elements. This makes it difficult to remember how any given language's standard library behaves.

An alternative solution might be named arguments.

-- 
Olaf

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

Standard Proposals Archives on Google Groups