hash_multiset
|
 |
A container that is optimized for
fast associative lookup. Items are matched using the user-supplied Equal
comparator. When an item is inserted into a hash_multiset
, it is stored in a data structure allows the item to be found quickly. Within
the data structure, the items are ordered according to a user-defined Hash
function object. Unlike a set , a multiset
can contain multiple copies of the same item.
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/hashset.h>
template< class T, class Hash, class Equal, class Allocator >
class hash_multiset
Interface
Constructor
explicit
hash_multiset( size_t n ,
const Hash& hash ,
const Equal& equal ,
float load_ratio ,
const Allocator& alloc )
Constructs an empty
multiset, with n (default 203
) initial table entries, that orders its elements 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_multiset(
const_iterator first ,
const_iterator last , size_t
n ,
const Hash& hash ,
const Equal& equal ,
float load_ratio ,
const Allocator& alloc )
Constructs a multiset
that contains copies of the elements in the range [
first , last .
Constructor
hash_multiset(
const hash_multiset< T, Hash, Equal, Allocator >& other
)
Constructs a copy of other
.
Destructor
~hash_multiset()
Destroys the multiset and
erases all of its items.
=
hash_multiset<
T, Hash, Equal, Allocator >& operator=( const hash_multiset< T,
Hash, Equal, Allocator >& other )
Replaces the contents of
the multiset with a copy of other .
begin
iterator
begin()
Returns an iterator
positioned at the multiset's first item.
begin
const_iterator
begin() const
Returns a constant
iterator positioned at the multiset's first item.
bucket_count
size_type
bucket_count() const
Returns the number of
hash buckets that this multiset contains.
clear
void
clear()
Erases all of the
multiset's elements.
count
size_type
count( const T& value )
const
Returns the number of
elements multiset contains that match value .
empty
bool
empty() const
Returns true
if the multiset contains no entries.
end
iterator
end()
Returns an iterator
positioned immediately after the multiset's last item.
end
const_iterator
end() const
Returns a constant
iterator positioned immediately after the multiset's last item.
erase
void
erase( iterator pos )
Erases the element at pos
.
erase
void
erase( iterator first ,
iterator last )
Erases the elements in
range [ first , last
) .
erase
size_type
erase( const T& value )
Erases all elements that
match value and returns the number of elements
erased.
find
iterator
find( const T& value )
If the multiset contains
an element that matches value , returns an
iterator positioned at the matching element. Otherwise, returns an iterator
positioned at end() .
find
const_iterator
find( const T& value )
const
If the multiset contains
an element that matches value , returns an
iterator positioned at the matching element. Otherwise, returns an iterator
positioned at end() .
get_allocator
Allocator
get_allocator() const
Returns a copy of the
allocator used 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 T& value )
Inserts a copy of value
and returns an iterator positioned at the new element.
insert
void
insert( const T* first ,
const T* last )
Inserts copies of the
elements in the range [ first
, last )
.
insert
void
insert( const_iterator first ,
const_iterator last )
Inserts copies of the
elements in the range [ first
, last )
.
insert
iterator
insert( iterator pos ,
const T& value )
Inserts a copy of value
and returns an iterator positioned at the new element. Uses pos
as a hint on where to start searching for the correct place to insert.
key_eq
Equal
key_eq() const
Returns the comparison
object.
max_size
size_type
max_size() const
Returns the maximum
number of entries the multiset can contain.
resize
void
resize( size_type n )
Resizes this multiset to
contain at least n hash buckets.
size
size_type
size() const
Returns the number of
entries the multiset contains.
swap
void
swap( hash_multiset< T, Hash, Equal, Allocator >& other
)
Exchanges the contents of
multiset and other .
Non-Member Functions
==
bool
operator==( const hash_multiset< T, Hash, Equal, Allocator >& x
, const hash_multiset< T, Hash,
Equal, Allocator >& y )
Returns true
if x contains the same items in the same order as y
.
<
bool
operator<( const hash_multiset< T, Hash, Equal, Allocator >& x
, const hash_multiset< T, Hash,
Equal, Allocator >& y )
Returns true
if x is lexicographically less than y
.
swap
void
swap( const hash_multiset< T, Hash, Equal, Allocator >& x
, const hash_multiset< T, 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.