Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #pragma once
00015
00019 #include <cassert>
00020
00021 namespace kNet
00022 {
00023 namespace sort
00024 {
00025
00026 template<typename T>
00027 int TriCmp(const T &a, const T &b)
00028 {
00029
00030 if (a < b) return -1;
00031 if (b < a) return 1;
00032
00033
00034 return 0;
00035 }
00036
00037 template<typename T>
00038 class TriCmpObj
00039 {
00040 public:
00041 int operator ()(const T &a, const T &b)
00042 {
00043 if (a < b) return -1;
00044 if (b < a) return 1;
00045 assert(a == b);
00046 return 0;
00047 }
00048 };
00049
00050 }
00051 }
00052