C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Named auto

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Thu, 29 Sep 2022 23:40:28 +0100
On Thu, 29 Sept 2022 at 20:42, Lénárd Szolnoki via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Hi,
>
> I don't like auto<class T> vector<T> because T needs to be present twice.
> It ceases to be concise once you steer away from one-letter names.
>
> Also what if you don't actually care about T here, but you want the
> overload to only match vectors? Then you can't use this syntax without
> needlessly introducing a name.
>
> I'm not married to the particular syntax I suggested to the two separate
> proposals, but I think if still has merit two handle the two cases
> separately.
>

Why not CTAD, then? int f(std::vector v);

Or possibly int f(std::vector auto v); - I recall there was a proposal a
while back to allow class templates to act like concepts, as adjectives.

Received on 2022-09-29 22:40:42