blob: 8834b5fff8014ceaac1d574eef713bf7b7e7935e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#pragma once
#define MAKESORTERTMPL(TRecord, MemberFunc) \
template <typename T> \
struct MemberFunc; \
template <> \
struct MemberFunc<TRecord> { \
bool operator()(const TRecord* l, const TRecord* r) { \
return TRecord ::MemberFunc(l, r) < 0; \
} \
int operator()(const TRecord* l, const TRecord* r, int) { \
return TRecord ::MemberFunc(l, r); \
} \
}
template <typename T>
static inline int compare(const T& a, const T& b) {
return (a < b) ? -1 : (a > b);
}
|