Template function : use the array's one !

TSalm TSalm at free.fr
Wed Feb 18 10:09:08 PST 2009


> TSalm Wrote:
>

>> int compare(T:T[])(T[] o1,T[] o2)
>
> Change this line to:
>   int compare(T:T[])(T o1, T o2)
>

You are right.

But despite this function, at compile time, an error is return :

.\src\tsalm\tools\Generic.d(20): Error: cannot implicitly convert  
expression (o2 - o1) of type int[3u] to int
.\src\tsalm\tools\Generic.d(33): template instance  
tsalm.tools.generic.compare!(int[3u]) error instantiating
Command C:\DMD\dsss\bin\rebuild.exe returned with code 1, aborting.
Error: Command failed, aborting.


More information about the Digitalmars-d-learn mailing list