New operators opStaticIndex and friends

Q. Schroll qs.il.paperinik at gmail.com
Wed May 15 01:07:10 UTC 2019


On Tuesday, 14 May 2019 at 16:15:20 UTC, H. S. Teoh wrote:
> On Tue, May 14, 2019 at 03:49:51PM +0000, Q. Schroll via 
> Digitalmars-d wrote:
>> I whish, D has these operators:
>> 
>> opStaticIndex
>> opStaticIndexAssign
>> opStaticIndexOpAssign
>> opStaticSlice
>> 
>> When used, they look the same way as opIndex and friends, but 
>> the stuff between [ and ] would be bound to template 
>> parameters (instead of runtime parameters) and be known at 
>> compile time. Basically, this allows to implement static 
>> indexing the same way it is possible for an AliasSeq.
>
> +1.  I'd love to have this feature too.
>
>
> T

I've made it into a DIP: https://github.com/dlang/DIPs/pull/155



More information about the Digitalmars-d mailing list