dynamic classes and duck typing
Álvaro Castro-Castilla
alvcastro at yahoo.es
Mon Nov 30 12:30:22 PST 2009
Walter Bright Wrote:
> 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.
It does. Shouldn't this work also?
struct foo {
void opDispatch( string name, T... )( T values ) {
}
}
void main( ) {
foo f;
f.bar( 3.14 );
}
Álvaro Castro-Castilla
More information about the Digitalmars-d
mailing list