diff options
Diffstat (limited to 'src/old/tests/ordhash.cpp')
| -rw-r--r-- | src/old/tests/ordhash.cpp | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/old/tests/ordhash.cpp b/src/old/tests/ordhash.cpp deleted file mode 100644 index f1d96ec..0000000 --- a/src/old/tests/ordhash.cpp +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 1 | #include "ordhash.h" | ||
| 2 | #include <string> | ||
| 3 | |||
| 4 | typedef struct eldef | ||
| 5 | { | ||
| 6 | eldef( int a, int b, const std::string &c ) : | ||
| 7 | id( a ), nSequence( b ), sName( c ) {} | ||
| 8 | int id; | ||
| 9 | int nSequence; | ||
| 10 | std::string sName; | ||
| 11 | } eldef; | ||
| 12 | |||
| 13 | struct seqcmp | ||
| 14 | { | ||
| 15 | bool operator()( eldef **a, eldef **b ) | ||
| 16 | { | ||
| 17 | return (*a)->nSequence < (*b)->nSequence; | ||
| 18 | } | ||
| 19 | }; | ||
| 20 | |||
| 21 | struct namcmp | ||
| 22 | { | ||
| 23 | bool operator()( eldef **a, eldef **b ) | ||
| 24 | { | ||
| 25 | return (*a)->sName < (*b)->sName; | ||
| 26 | } | ||
| 27 | }; | ||
| 28 | |||
| 29 | typedef OrdHash<int, eldef, seqcmp> AHash; | ||
| 30 | //typedef OrdHash<int, eldef, namcmp> AHash; | ||
| 31 | |||
| 32 | int main() | ||
| 33 | { | ||
| 34 | AHash hsh; | ||
| 35 | hsh[1] = eldef( 0, 43, "Bob"); | ||
| 36 | hsh[4] = eldef( 1, 443, "Abby"); | ||
| 37 | hsh[2] = eldef( 2, 1, "Name"); | ||
| 38 | hsh[5] = eldef( 3, 0, "Catagory"); | ||
| 39 | hsh[32] = eldef( 4, 12, "Epilogue"); | ||
| 40 | |||
| 41 | for( AHash::iterator i = hsh.begin(); i != hsh.end(); i++ ) | ||
| 42 | { | ||
| 43 | eldef e = (*i).second; | ||
| 44 | printf("%d, %d, %s\n", e.id, e.nSequence, e.sName.c_str() ); | ||
| 45 | } | ||
| 46 | |||
| 47 | } | ||
| 48 | |||
