Partial specialisation: howto? (in the right news group this time. *sigh*)

Simen Kjaeraas simen.kjaras at gmail.com
Sun May 17 12:00:44 PDT 2009


div0 wrote:

> Thanks Simen,
>
> That's nicer than the chained static ifs.
> Is there anyway to get rid of the enum though?

I would believe this to work:


template createHandlerCode( T... ) if ( is( T == msgRangeHdlr ) ) {
	string format( ) {
		return createMessageRangeHandler!(T).format();
	}
}
template createHandlerCode( T... ) if ( is( T == msgHdlr ) ) {
	string format( ) {
		return createMessageHandler!(T).format();
	}
}
template createHandlerCode( T... ) if ( is( T == cmdIdHdlr ) ) {
	string format( ) {
		return createCommandIdHandler!(T).format();
	}
}

--
  Simen


More information about the Digitalmars-d-learn mailing list