C++ Logo

liaison

Advanced search

Re: [isocpp-wg14/wg21-liaison] VLA notation in parameter

From: Martin Uecker <ma.uecker_at_[hidden]>
Date: Wed, 13 Aug 2025 10:45:53 +0200
Am Dienstag, dem 12.08.2025 um 23:23 +0200 schrieb Jens Maurer:
>
> On 12.08.25 09:35, Martin Uecker wrote:
> > Yes. Sorry, I wasn't clear. My point was that if you wanted
> > to avoid the "template" notation and write this with "auto"
> > like this
> >
> > void foo(std::array<float, sizeof(b)>, auto b);
> >
> > this would not work.
>
> At least the first mention of "b" would not refer to the
> second parameter, but maybe to a "b" introduced in the
> surrounding scope somewhere.
>
> > But my impression was that C++ is
> > moving towards this nicer way of writing templates.
>
> C++ is offering this as a short-hand, but I'm not seeing
> a tidal move in this direction. Being able to refer to
> the name of a template parameter (e.g. for constraints)
> is useful in a lot of situations. Also, I haven't
> seen much use of "auto" parameters in recent library
> proposals accepted into C++.

So would you say the template syntax that forwards declares
the typename is good enough?

Martin

Received on 2025-08-13 08:45:57