void myFunc(T: !=int)(T value)

tsalm tsalm at free.fr
Sat Aug 23 04:09:13 PDT 2008


Le Fri, 22 Aug 2008 23:31:18 +0200, Sean Kelly <sean at 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 ...


More information about the Digitalmars-d-learn mailing list