Const Tuples
Dicebot via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Apr 25 04:53:42 PDT 2014
On Friday, 25 April 2014 at 11:51:48 UTC, bearophile wrote:
> They are not the same type:
>
>
> void main() {
> import std.typecons: Tuple;
> alias T1 = const Tuple!(int, int);
> alias T2 = Tuple!(const int, const int);
> static assert(is(T1 == T2)); // Fails.
> }
>
>
> This type difference causes some troubles when you use tuples.
>
> Bye,
> bearophile
Why would you even expect those to be same types? These 2 types
are also different:
struct A
{
const int x;
}
alias A_ = const(A);
More information about the Digitalmars-d-learn
mailing list