Date: Tue, 12 Aug 2025 23:23:55 +0200
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++.
Jens
> 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++.
Jens
Received on 2025-08-12 21:23:59