class templates and static if

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Feb 26 17:01:21 PST 2012


The immutable is not necessary, use:
auto h = new Parser!(Type.request)("Hello world");

Otherwise, if you really want to declare the type instead of infering
it you can write:
Parser!(Type.request) h = new Parser!(Type.request)("Hello world");

You can also do:
Parser!(Type.request) h;
h = new typeof(h)("Hello world");

or:
alias Parser!(Type.request) ParseRequest;
ParseRequest h = new ParseRequest("Hello world");

Also, 'static' on the enum declaration doesn't really do anything. :)


More information about the Digitalmars-d-learn mailing list