Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4973 | right-hear | 1 | #ifndef _ALGORITHM_INCLUDED |
2 | #define _ALGORITHM_INCLUDED |
||
3 | #include |
||
4 | #include |
||
5 | namespace std |
||
6 | { |
||
7 | static bool (*__cmpfn)(const void* elem1, const void* elem2); |
||
8 | static int __compare(const void* elem1, const void* elem2) |
||
9 | {return __cmpfn(elem1,elem2)?-1:1;} |
||
10 | template |
||
11 | void sort(T* first, T* last, Pred pr) |
||
12 | { |
||
13 | __cmpfn=(bool(*)(const void*,const void*))pr; |
||
14 | qsort(first,last-first,sizeof(*first),&__compare); |
||
15 | } |
||
16 | } |
||
17 | #endif |