]>
git.saurik.com Git - wxWidgets.git/blob - interface/hashmap.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxHashMap class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 This is a simple, type-safe, and reasonably efficient hash map class,
14 whose interface is a subset of the interface of STL containers. In
15 particular, the interface is modeled after std::map, and the various,
16 non-standard, std::hash_map.
28 wxHashMap(size_type size
= 10);
29 wxHashMap(const wxHashMap
& map
);
34 Returns an iterator pointing at the first element of the hash map.
35 Please remember that hash maps do not guarantee ordering.
37 const_iterator
begin();
42 Removes all elements from the hash map.
47 Counts the number of elements with the given key present in the map.
48 This function returns only 0 or 1.
50 size_type
count(const key_type
& key
);
53 Returns @true if the hash map does not contain any elements, @false otherwise.
59 Returns an iterator pointing at the one-after-the-last element of the hash map.
60 Please remember that hash maps do not guarantee ordering.
68 Erases the element pointed to by the iterator. After the deletion
69 the iterator is no longer valid and must not be used.
71 size_type
erase(const key_type
& key
);
72 void erase(iterator it
);
73 void erase(const_iterator it
);
78 If an element with the given key is present, the functions returns
79 an iterator pointing at that element, otherwise an invalid iterator
80 is returned (i.e. hashmap.find( non_existent_key ) == hashmap.end()).
82 iterator
find(const key_type
& key
);
83 const_iterator
find(const key_type
& key
);
87 Inserts the given value in the hash map. The return value is
88 equivalent to a @c std::pairiterator(), bool;
89 the iterator points to the inserted element, the boolean value
90 is @true if @c v was actually inserted.
92 Insert_Result
insert(const value_type
& v
);
95 Use the key as an array subscript. The only difference is that if the
96 given key is not present in the hash map, an element with the
97 default @c value_type() is inserted in the table.
99 mapped_type
operator[](const key_type
& key
);
102 Returns the number of elements in the map.