C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Question regarding auto as template argument

From: Lénárd Szolnoki <cpp_at_[hidden]>
Date: Sun, 21 May 2023 20:21:37 +0100
On 21 May 2023 14:52:27 BST, Barry Revzin via Std-Proposals <std-proposals_at_[hidden]> wrote:
>On Sun, May 21, 2023, 3:15 AM Михаил Найденов via Std-Proposals <
>std-proposals_at_[hidden]> wrote:
>
>> Hello, Is the following usage of auto proposed and evaluated:
>>
>> void func(std::vector<auto> v);
>>
>> Which will result in
>>
>> template<class T>
>> void func(std::vector<T> v);
>>
>> Thank You
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Няма
>> вирусиwww.avast.com
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>
>
>It was valid in the Concepts TS, but it wasn't included in C++20 and hasn't
>been proposed.
>
>I'm not sure about the syntax though, since auto everywhere else in C++ is
>introducing a variable. Here, it's not. array<T, auto> would make more
>sense, but isn't exactly in high demand.

I'm not sure about that. auto is a placeholder type. smart_ptr<auto> would be analogous to auto*. What am I missing here?

>
>Barry
>
>>

Received on 2023-05-21 19:21:46