C++ Logo

std-proposals

Advanced search

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

From: mauro russo <ing.russomauro_at_[hidden]>
Date: Sun, 17 Nov 2024 00:01:39 +0100
> I can kinda see some use cases for this, but I think the current syntax
> is a bit confusing and not so easy to reason about.
> And since it is fairly easy to get around this sorts of limitation by
using wrappers
> for the separate packs, you must provide a syntax and usage that is so
much
> simpler that it is worth the effort (for both compilermakers and
developers
> using the feature to learn it).

Thank you Robin.

Ok, I see a possibility in your words that someone might consider it
valuable.
Posts here are to filter out ideas for which strong motivations exist to
stop.

I will then collect more structured considerations on this floating idea
and present asap, including the comparison with the current workarounds.

Hope you may provide any initial comment also on the extended delete
in template-ids to limit the set of overloading template functions that
may match.

e.g., exploiting also the extended use of 'auto' :
func<auto, delete> : only templates with 1 parameter may match
func<auto[5]> : only templates with at least 5 parameters may match
(unfortunately, no possible 'at most' without further extensions).
An alternative with constraints on sizeof... is only possible
for parameter packs of the same template.
I will compare also these ones with alternatives using wrappers.

Received on 2024-11-16 23:01:52