Const Tuples

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 25 06:51:50 PDT 2014


Meta:

> I think it's a bad idea to make these equal for this reason: if 
> T1 == T2, then you would expect Unqual!T1 == Unqual!T2. However:
>
> alias T1 = const Tuple!(int, int);
> alias T2 = Tuple!(const int, const int);
> assert(is(T1 == T2));
>
> alias UnT1 = Unqual!T1; // Tuple!(int, int)
> alias UnT2 = Unqual!T2; // Tuple!(const int, const int)
> assert(is(UnT1 == UnT2));

If we introduce structural typing for tuples (to make T1 and T2 
the same type), then Unqual!T2 is Tuple!(int, int). It's like for 
a const(const(int)[2]).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list