On 2009-11-29 06:14:21 -0500, "Simen kjaeraas" <[email protected]> said:

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." );
   }
}

Wouldn't this be even better?

        string opDispatch(string name)() if (name == "foo") {
                return "foo";
        }

I haven't tested that it works though.

--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to