overiding mutable methods in immutable classes

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 22 01:57:54 PST 2014


On Saturday, 22 November 2014 at 02:37:21 UTC, Eric wrote:
> I know I can make a class immutable, but the problem is I want
> to constrain a template parameter to only immutable types,
> and I want to use class types.

template Foo(T : immutable Object)

Accepts immutable(Object) and other immutable class types.
Rejects non-immutable class types like Object and const(Object),
and non-class types.


More information about the Digitalmars-d-learn mailing list