DIP63 : operator overloading for raw templates

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 16 17:26:55 PDT 2014


On Sunday, 15 June 2014 at 18:32:31 UTC, Dicebot wrote:
> http://wiki.dlang.org/DIP63
>
> This is solution for a problem I am currently having with 
> implementing http://wiki.dlang.org/DIP54 (afair it was also 
> mentioned by Timon Gehr during old discussion of that DIP)
>
> New proposed semantics ( to catch your attention and get to 
> read the link ;) ):
>
> template Pack(T...)
> {
>     alias expand = T;
>
>     alias opIndex(size_t index) = T[index];
>     alias opSlice(size_t lower, size_t upper) = 
> Pack!(T[lower..upper]);
>     alias opDollar = T.length;
> }
>
> // no ambiguity as Pack!(int, int) is not a valid type
> // is(element == int)
> alias element = Pack!(int, int)[1];

I have nothing against it BUT...

The fact that you need this is a proof that 
TemplateArgumentList/TemplateArgumentPack have actually use 
outside being template argument list and/or pack.

Your just defeated you whole Q/A on DIP54...


More information about the Digitalmars-d mailing list