July 16, 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

July 16, 2013
On Tuesday, 16 July 2013 at 02:59:50 UTC, Ali Çehreli wrote:
> 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

This would essentially work but I really would prefer a short hand notation immutable(struct) S.  I am nesting structs and would have a lot of aliases.
1 2
Next ›   Last »