diff options
author | Mike Buland <eichlan@xagasoft.com> | 2008-02-20 08:07:31 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2008-02-20 08:07:31 +0000 |
commit | 3cea09281c9f809fc78de6f2e79f4117976f74e4 (patch) | |
tree | 7dccb751019a38bf93bffce61e5683d72a1fe842 /src/util.h | |
parent | a4c22303b1044eee5ccbf0766895a879a8f4810e (diff) | |
download | libbu++-3cea09281c9f809fc78de6f2e79f4117976f74e4.tar.gz libbu++-3cea09281c9f809fc78de6f2e79f4117976f74e4.tar.bz2 libbu++-3cea09281c9f809fc78de6f2e79f4117976f74e4.tar.xz libbu++-3cea09281c9f809fc78de6f2e79f4117976f74e4.zip |
Applied an update from Hash to Set (they're basically the same logic/code, in
fact, I need to get in there and change all the comments and exceptions in Set
to refer to Set and not Hash). Util has the functors in it that are shared now,
and List actually uses those functors for it's insertSorted function, that thing
has come in so handy.
Diffstat (limited to '')
-rw-r--r-- | src/util.h | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -35,6 +35,46 @@ namespace Bu | |||
35 | { | 35 | { |
36 | return min( max( a, b ), c ); | 36 | return min( max( a, b ), c ); |
37 | } | 37 | } |
38 | |||
39 | // | ||
40 | // Basic comparison functors | ||
41 | // | ||
42 | template<typename item> | ||
43 | struct __basicLTCmp | ||
44 | { | ||
45 | bool operator()( const item &a, const item &b ) | ||
46 | { | ||
47 | return a < b; | ||
48 | } | ||
49 | }; | ||
50 | |||
51 | template<typename item> | ||
52 | struct __basicGTCmp | ||
53 | { | ||
54 | bool operator()( const item &a, const item &b ) | ||
55 | { | ||
56 | return a > b; | ||
57 | } | ||
58 | }; | ||
59 | |||
60 | template<typename item> | ||
61 | struct __basicPtrLTCmp | ||
62 | { | ||
63 | bool operator()( const item &a, const item &b ) | ||
64 | { | ||
65 | return *a < *b; | ||
66 | } | ||
67 | }; | ||
68 | |||
69 | template<typename item> | ||
70 | struct __basicPtrGTCmp | ||
71 | { | ||
72 | bool operator()( const item &a, const item &b ) | ||
73 | { | ||
74 | return *a > *b; | ||
75 | } | ||
76 | }; | ||
77 | |||
38 | }; | 78 | }; |
39 | 79 | ||
40 | #endif | 80 | #endif |