Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

rw_hashmap<K,T,H,EQ,A>

Module:  Essential Tools Module   Group:  STL Extension-based Collection Classes


Does not inherit

Local Index

Members

Synopsis

#include <rw/stdex/hashmap.h>
rw_hashmap<K,T,H,EQ,A=std::allocator<std::pair<const K,T>>>;

rw_hashmap<K,T,H,EQ,A> requires the C++ Standard Library.

Description

Class rw_hashmap<K,T,H,EQ,A> maintains a collection of mappings between K and V, implemented as a hash table of pair<const K,V>. operator== must be defined for type V. Pairs with duplicate keys are not allowed. Two pairs having duplicate keys is the result of the EQ comparison, applied to the first element of each, is true.

Since this is a value based collection, objects are copied into and out of the collection.

As with all classes that meet the ANSI associative container specification, rw_hashmap<K,T,H,EQ,A> provides for iterators that reference its elements. Operations that alter the contents of rw_hashmap<K,T,H,EQ,A> may invalidate other iterators that reference the container. Since the contents of rw_hashmap<K,T,H,EQ,A> are in pseudo-random order, the only iterator ranges that will usually make sense are the results of calling equal_range(key), and the entire range from begin() to end().

Persistence

None

Public Typedefs

typedef K key_type;
typedef Hash key_hash; 
typedef EQ key_equal; 
typedef pair<K,V> value_type; // or ... "const K"
typedef (unsigned) size_type; //from rw_slist<T,A>
typedef (int) difference_type; // from rw_slist<T,A>
typedef (value_type&) reference; 
typedef (const value_type&) const_reference; //from rw_slist<T,A>
typedef (scoped Iterator) iterator;
typedef (scoped ConstIterator) const_iterator; 

Public Constructors

rw_hashmap<K,T,H,EQ,A>(size_type sz = 1024, 
                        const Hash& h = Hash(), 
                        const EQ& eq = EQ());
rw_hashmap<K,T,H,EQ,A>(const rw_hashmap<K,T,
                        H,EQ,A>& map);
rw_hashmap<K,T,H,EQ,A>(const_iterator first, 
                        const_iterator bound
                        size_type sz=1024,
                        const Hash& h = Hash(), 
                        const EQ& eq = EQ());
rw_hashmap<K,T,H,EQ,A>(const value_type* first, 
                        const value_type* bound
                        size_type sz=1024,
                        const Hash& h = Hash(), 
                        const EQ& eq = EQ());

Public Destructor

~rw_hashmap<K,T,H,EQ,A>();

Public Operators

rw_hashmap<K,T,H,EQ,A>&
operator=(const rw_hashmap<K,T,H,EQ,A>& rhs);
bool
operator==(const rw_hashmap<K,T,H,EQ,A> & rhs) const;
V&
operator[](const key_type& key);

Accessors

iterator
begin();
const_iterator
begin() const;
iterator
end();
const_iterator
end() const;
pair<const_iterator, const_iterator>
equal_range(const key_type key) const;
pair<iterator, iterator>
equal_range(const key_type key);
const_iterator
lower_bound(const key_type& key) const;
iterator
lower_bound(const key_type& key);
const_iterator
upper_bound(const key_type& key) const;
iterator
upper_bound(const key_type& key);

Const Public Member Functions

size_type
capacity() const;
bool
empty() const;
float
fill_ratio() const;
size_type
size() const;

Mutators

void
clear();
size_type
erase(const key_type& key);
iterator
erase(iterator iter);
iterator
erase(iterator first, iterator bound);
pair<iterator,bool>
insert(const value_type& val);
size_type
insert(iterator ignore, const value_type& val);
size_type
insert(const value_type* first, const value_type* bound);
size_type
insert(const_iterator first, const_iterator bound);
void
swap(rw_hashmap<K,T,H,EQ,A>& other);

Special Methods for Maps

size_type
count(const key_type& key) const;
bool
equal_by_keys(const rw_hashmap<K,T,H,EQ,A>& rhs) const;
const_iterator
find(const key_type& key) const;
iterator
find(const key_type& key);
void
resize(size_type sz);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.