Boian Mitov  wrote / napísal(a):
And the same code will work both with normal array and with object implementing iterators ?
I am not sure it will.
How I can call your sort for a linked list container instead on array?
Am I missing something or your code works with arrays only.
The STL sort will work with arrays or with STL containers or with any class that implements the concept (I.E. defines iretator and reference types, and has iterator generating function etc.)
As the best of my knowledge this is not doable with generics.
C++ is doing it, but there is no validation mechanism aside from just plain old testing all possible combinations ;-) .

 With best regards,
   Boian Mitov

Was just a case example.

I looked at their code, and it's full of hacks. Practically, they do what I did for basic types (e.g: arrays) with overloads. For classes they do a runtime detection wether it is a container implementing the interface and then procede that way.

I'd be doable in pascal too, but I'm still dizzy from looking at their code :)

Ales
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to