Tuple/Typedef question

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jan 11 04:33:49 PST 2015


On Sun, 11 Jan 2015 12:00:19 +0000
Martin via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:

> > as for `Typedef!` -- you can use it's third arg, "cookie":
> >
> >   import std.typecons;
> >
> >   alias T1 = Tuple!(int, int);
> >   alias T2 = Tuple!(int, int);
> >
> >   alias T1New = Typedef!(T1, T1.init, "t0");
> >   alias T2New = Typedef!(T2, T2.init, "t1");
> >
> >   pragma(msg, __traits(isSame, T1New, T2New)); // false
> >
> > there was a heated discussion about `std.typecons.Typedef`, 
> > built-in
> > `typedef` and other related things, but the decision was to 
> > keep the
> > status quo.
> 
> I can't believe I missed the cookie part. Thanks!
this part deserves a better explanation in docs, 'cause it's easy to
miss the details, especially for those who assumed that each `Typedef!`
creates a distinct type. too bad that my writing skills sux (and i'm
really biased against the current `Typedef!`).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150111/c7551a45/attachment.sig>


More information about the Digitalmars-d-learn mailing list