August 23, 2008
Le Fri, 22 Aug 2008 23:31:18 +0200, Sean Kelly <sean@invisibleduck.org> a écrit:

> For the record, though, this should work:
>
> struct S
> {
>     int opCmp()( S val ) {}
>     int opCmp(T)( T val ) {}
> }
>
> ie. you make both templates and one just has no parameters.  I'm not
> sure if the compiler will be able to make this work with the built-in
> sort routine, however, so you may want to try:
>
> struct S
> {
>     int opCmp(T)( T val ) {}
>     alias opCmp!(S) opCmp;
> }
>
> Or something like that as well.  I'd like to believe that there is some way
> to make this work with the compiler as-is.
>

No, none of the twice :(

 struct S
 {
    int opCmp()( S val ) {}
    int opCmp(T)( T val ) {}
 }
return
 opCmp() matches more than one function template declaration, opCmp() and opCmp(T)

and the alias :
 alias sortBug.A.opCmp recursive alias declaration

But I'm on dmd 1.0, maybe it's resolv on 2.0 ...
1 2
Next ›   Last »