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