dynamic classes and duck typing

Walter Bright newshound1 at digitalmars.com
Mon Nov 30 10:07:38 PST 2009


Simen kjaeraas wrote:
> This still does not compile:
> 
> struct foo {
>     void opDispatch( string name, T )( T value ) {
>     }
> }
> 
> void main( ) {
>     foo f;
>     f.bar( 3.14 );
> }
> 
> test.d(10): Error: template instance opDispatch!("bar") does not match 
> template
> declaration opDispatch(string name,T)

It works when I try it.



More information about the Digitalmars-d mailing list