-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnatural_cmp.h
More file actions
20 lines (18 loc) · 1.94 KB
/
natural_cmp.h
File metadata and controls
20 lines (18 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// ReSharper disable once CppMissingIncludeGuard
#ifndef T
#error you need to define T before including this header
#else
#ifndef NATURAL_CMP
#define NATURAL_CMP(T) \
int CAT(natural_cmp, T)(T a, T b) { \
if (a > b) { \
return 1; \
} \
if (a < b) { \
return -1; \
} \
return 0; \
}
#endif
#undef T
#endif