hash_multimap
|
 |
An associative container that
manages a set of ordered key/value pairs. The pairs are ordered by key, based on
a user-supplied hash function. More than one value can be associated with a
particular key. You can quickly find all of these values due to the hash_multimap
's underlying data structure.
Hash containers are only a
proposed addition to the ANSI/ISO Standard Template Library, and have not been
accepted for inclusion in the final specification. We have included hash
containers in Standards<ToolKit> to provide you with the latest STL
technology available.
Library
Standards<ToolKit>
Declaration
#include <ospace/osstd/hashmap.h>
template
<
class Key,
class Value,
class Hash,
class Equal,
class Allocator
>
class hash_multimap
Interface
Constructor
explicit
hash_multimap( size_t n ,
const Hash& hash ,
const Equal& equal ,
float load_ratio ,
const Allocator& alloc )
Constructs an empty
multimap, with n (default 203
) initial table entries, that orders its keys using the hash
function (default Hash() ), key comparison
function equal (default Equal()
), and allocator alloc (default Allocator()
). The load_ratio value (default 0.75
) is used to tune the internal hash table.
Constructor
hash_multimap(
const_iterator first ,
const_iterator last ,
size_t n ,
const Hash& hash ,
const Equal& equal ,
float load_ratio ,
const Allocator& alloc )
Constructs a multimap to
contain copies of the key/value pairs in the range [
first , last ).
Constructor
hash_multimap(
const hash_multimap< Key, Value, Hash, Equal, Allocator >& other
)
Constructs a copy of other
.
Destructor
~hash_multimap()
Destroys the multimap and
erases all of its key/value pairs.
=
hash_multimap<
Key, Value, Hash, Equal, Allocator >& operator=( const hash_multimap<
Key, Value, Hash, Equal, Allocator >& other
)
Replaces multimap's
contents with a copy of other 's.
begin
iterator
begin()
Returns an iterator
positioned at the multimap's first key/value pair.
begin
const_iterator
begin() const
Returns an iterator
positioned at the multimap's first key/value pair.
bucket_count
size_type
bucket_count() const
Returns the number of
hash buckets that this multimap contains.
clear
void
clear()
Erases all of the
multimap key/value pairs.
count
size_type
count( const Key& key )
const
Returns the number of
key/value pairs that the multimap contains with a key that matches key
.
empty
bool
empty() const
Returns true
if the multimap contains no entries.
end
iterator
end()
Returns an iterator
positioned immediately after the multimap's last key/value pair.
end
const_iterator
end() const
Returns an iterator
positioned immediately after the multimap's last key/value pair.
erase
void
erase( iterator pos )
Erases the key/value pair
at pos .
erase
void
erase( iterator first ,
iterator last )
Erases the key/value
pairs in range [ first
, last ) .
erase
size_type
erase( const Key& key )
Erases all key/value
pairs with a key that matches key and returns the
number of elements erased.
find
iterator
find( const Key& key )
const
If the multimap contains
a key/value pair with a key that matches key ,
returns an iterator positioned at the matching pair. Otherwise, returns an
iterator positioned at end() .
find
const_iterator
find( const Key& key )
const
If the multimap contains
a key/value pair with a key that matches key ,
returns a const iterator positioned at the matching pair. Otherwise, returns
a const iterator positioned at end() .
get_allocator
Allocator
get_allocator() const
Returns a copy of the
allocator the multimap is using to manage storage.
hash_funct
Hash
hash_funct() const
Returns a copy of the
hash function that map is using to order elements.
insert
iterator
insert( const value_type& pair )
Inserts a copy of the
key/value pair pair , and returns an iterator to
the new key/value pair.
insert
void
insert( const value_type* first ,
const value_type*
last )
Inserts copies of the
key/value pairs in the range [ first
, last ) .
insert
void
insert( const_iterator first ,
const_iterator last )
Inserts copies of the
key/value pairs in the range [ first
, last ) .
key_eq
Equal
key_eq() const
Returns the comparison
object used to compare the multimap's keys.
max_size
size_type
max_size() const
Returns the maximum
number of key/value pairs that a multimap can contain.
resize
void
resize( size_type n )
Resizes this multimap to
contain at least n hash buckets.
size
size_type
size() const
Returns the number of
key/value pairs the multimap contains.
swap
void
swap( hash_multimap< Key, Value, Hash, Equal, Allocator >& other
)
Exchanges the contents of
multimap and other .
Non-Member Functions
==
bool
operator==( const hash_multimap< Key, Value, Hash, Equal, Allocator
>& x ,
const hash_multimap< Key, Value, Hash, Equal, Allocator >& y
)
Returns true
if x contains the same items in the same order as y
.
<
bool
operator<( const hash_multimap< Key, Value, Hash, Equal, Allocator
>& x ,
const hash_multimap< Key, Value, Hash, Equal Allocator >& y
)
Returns true
if x is lexicographically less than y
.
swap
void
swap( const hash_multimap< Key, Value, Hash, Equal, Allocator >& x
, const hash_multimap< Key,
Value, Hash, Equal, Allocator >& y )
Exchanges the contents of
x and y .
Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.