Le 29/11/09 12:14, Simen kjaeraas a écrit :
That is because your opDispatch is instantiated no matter what the name
is, but only does something sensible if it's foo. Try this:

string opDispatch( string name )( ) {
static if ( name == "foo" ) {
return "foo";
} else {
static assert( false, "Invalid member name." );
}
}


Ok but what still looks confusing is that the error is reported on the template code, as for any template instantiation error, while the user could not be aware of being instantiating a template (or should he?).

Anyway, this feature is fun to play with.

Reply via email to