Problem with immutables and Template typeof(this)

Tobias Pankrath via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Dec 28 14:21:05 PST 2014


>
> Well, the type is ExampleTemplate. No reason not to write it
> directly. If you cannot for whatever reason I currently do not
> see: cast to Unqual!(typeof(this)).
> See http://dlang.org/phobos/std_traits.html

Also: Casting with no Type or CastQual removes any top level
const, immutable, shared or inout type modifiers from the type of
the UnaryExpression.

shared int x;
assert(is(typeof(cast()x) == int));


More information about the Digitalmars-d-learn mailing list