// Purpose: interface of wxHashMap
// Author: wxWidgets team
// RCS-ID: $Id$
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
This is a simple, type-safe, and reasonably efficient hash map class,
whose interface is a subset of the interface of STL containers.
- In particular, the interface is modeled after std::map, and the various,
- non-standard, std::hash_map.
+ In particular, the interface is modelled after std::map, and the various,
+ non-standard, std::hash_map (http://www.cppreference.com/wiki/stl/map/start).
Example:
@code
@endcode
The HASH_T and KEY_EQ_T are the types used for the hashing function and
key comparison. wxWidgets provides three predefined hashing functions:
- wxIntegerHash for integer types ( int, long, short, and their unsigned counterparts ),
- wxStringHash for strings ( wxString, wxChar*, char* ), and wxPointerHash for
+ @c wxIntegerHash for integer types ( int, long, short, and their unsigned counterparts ),
+ @c wxStringHash for strings ( wxString, wxChar*, char* ), and @c wxPointerHash for
any kind of pointer.
- Similarly three equality predicates: wxIntegerEqual, wxStringEqual,
- wxPointerEqual are provided.
+ Similarly three equality predicates: @c wxIntegerEqual, @c wxStringEqual,
+ @c wxPointerEqual are provided.
Using this you could declare a hash map mapping int values to wxString like this:
@code
WX_DECLARE_HASH_MAP( int,
wxString,
- wxIntegerHash,
- wxIntegerEqual,
+ ::wxIntegerHash,
+ ::wxIntegerEqual,
MyHash );
// using an user-defined class for keys
WX_DECLARE_HASH_MAP( MyKey, // type of the keys
SOME_TYPE, // any type you like
- MyKeyHash, // hasher
- MyKeyEqual, // key equality predicate
+ ::MyKeyHash, // hasher
+ ::MyKeyEqual, // key equality predicate
CLASSNAME); // name of the class
@endcode
it + 3, it1 - it2.
+ @section hashmap_predef Predefined hashmap types
+
+ wxWidgets defines the following hashmap types:
+ - wxLongToLongHashMap (uses long both for keys and values)
+ - wxStringToStringHashMap (uses wxString both for keys and values)
+
+
@library{wxbase}
@category{containers}
*/
/**
If an element with the given key is present, the functions returns an
iterator pointing at that element, otherwise an invalid iterator is
- returned; i.e.
+ returned.
+
@code
hashmap.find( non_existent_key ) == hashmap.end()
@endcode