immutable struct/class is mutable!

Ali Çehreli acehreli at yahoo.com
Mon Jul 15 19:59:49 PDT 2013


On 07/15/2013 07:50 AM, JS wrote:

 > Why does isMutable and isAssignable return true for a struct/class that
 > are immutable?
 >
 > immutable struct A { }
 >
 > isMutable!A returns true.

import std.traits;

struct S
{}

alias ImmutableS = immutable(S);

void main()
{
     static assert(!isMutable!ImmutableS);
     static assert(!isAssignable!ImmutableS);
}

Is that what you are looking for?

Ali



More information about the Digitalmars-d-learn mailing list