C++ Logo

std-proposals

Advanced search

Re: [std-proposals] default, delete, and auto for templates and other contexts

From: zxuiji <gb2985_at_[hidden]>
Date: Sat, 16 Nov 2024 14:43:14 +0000
So your idea of better c++ which is intended to be LESS confusing than C
(and I find it to be the opposite ironically) is to add yet more confusion
to the mix by overloading existing keywords? Why not try inventing some new
keywords instead?

On Fri, 15 Nov 2024 at 10:22, mauro russo via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> hello,
>
> in https://lists.isocpp.org/std-proposals/2024/11/11517.php I tried to
> propose extended usage of default, delete, auto, likely a too long post.
>
> Therefore, let me restrict here below the third part I consider more
> interesting:
>
> A way to allow parameter packs not to be the last for a main template,
> based on 'auto' used as explicit template argument
>
> declaration:
> template<typename... T, typename... U>
> void f(T... t, U... u);
>
> invocation:
> f<auto...[2]>(1, 'b', 2.);
>
> forced to deduce only two parameter types for the first parameter pack.
>
>
> An extended use may be:
> declaration:
> template<typename V, typename W>
> void g(V v, W w);
>
> invocation:
> g<auto, char>(1, 'b');
>
> which will force second parameter as char, while leaving first parameter
> to be deduced.
>
> It is a kind of 'default deduction'.
>
> Then auto[N] may be a syntax sugar in place of repeating "auto," N times
> in case the (N+1)-th parameter has to be explicit.
>
> In case, "auto..." would be a redundant option to use for the last
> parameter pack.
>
> Not sure where "auto" (instead of "auto...") should work also for (the
> last) parameter pack.
>
> Is this 'defaulted' behaviour considered evil as default parameter values
> for functions ?
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2024-11-16 14:33:51