Frist Draft (in this forum): Enum Parameters

Steven Schveighoffer schveiguy at gmail.com
Fri Apr 26 02:47:18 UTC 2024


On Thursday, 25 April 2024 at 17:56:59 UTC, Quirin Schroll wrote:
> https://github.com/Bolpat/DIPs/blob/2bfef0b05e99c5448b416078da2e743482e3193d/DIPs/1NNN-QFS.md
>
> This supersedes my idea of static indexing. The static indexing 
> DIP draft even said that if some way to pass values as 
> compile-time constants to functions, that would supersede it.
>
> **Abstract**
> On function templates, allow `enum` to be used as a function 
> parameter storage class and a member function attribute. 
> Arguments binding to `enum` parameters must be compile-time 
> constants, as if template value parameters. With `auto enum`, 
> “compile-time-ness” is determined from argument (cf. `auto 
> ref`) and queried via a trait.

I would love to see this happen. This is like a streamlining of 
template value parameters, akin to how lambdas streamline 
template type parameters.

I have thoughts on reworking interpolation tuples if this got 
in...

-Steve


More information about the dip.development mailing list