
January 14th, 2013, 04:04 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
Quote: | Originally Posted by mitakeet If you are using C++ just use std::map. If you do it in C (and don't use a library) you are going to be writing 100's of lines of code that all has to work perfectly, not simple or easy even for experts. |
On a *nix system with a C compiler, you can use hcreate(), hsearch() and hfree(). Alternatively, you could use a third party library such as Apache's APR library (specifically, the apr_hash_xx routines), which is portable across multiple platforms.
For C++, you could use std::unordered_map instead of std::map if you have a C++ 0x standard compliant compiler. For older C++ compilers, most of them support a std::hash_map template even though it wasn't part of the standard  . std::hash_map is faster than std::map (because std::map sorts on every item insert)
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
|