|
| rw_orderedhashmap (size_type cap=64, const hasher &h=hasher(), const key_equal_type &eq=key_equal_type()) |
|
| rw_orderedhashmap (const rw_orderedhashmap &other) |
|
| rw_orderedhashmap (rw_orderedhashmap &&other) |
|
template<typename InputIterator > |
| rw_orderedhashmap (InputIterator first, InputIterator last, size_type cap=64, const hasher &h=hasher(), const key_equal_type &eq=key_equal_type()) |
|
| ~rw_orderedhashmap () |
|
iterator | begin () |
|
const_iterator | begin () const |
|
size_type | capacity () const |
|
const_iterator | cbegin () const |
|
const_iterator | cend () const |
|
void | clear () |
|
size_type | count (const key_type &key) const |
|
bool | empty () const |
|
iterator | end () |
|
const_iterator | end () const |
|
bool | equal_by_keys (const rw_orderedhashmap &rhs) const |
|
std::pair< iterator, iterator > | equal_range (const key_type &key) |
|
std::pair< const_iterator, const_iterator > | equal_range (const key_type &key) const |
|
size_type | erase (const key_type &key) |
|
iterator | erase (iterator iter) |
|
iterator | erase (iterator iter, iterator bound) |
|
float | fill_ratio () const |
|
iterator | find (const key_type &key) |
|
const_iterator | find (const key_type &key) const |
|
std::pair< iterator, bool > | insert (const value_type &val) |
|
iterator | insert (iterator hint, const value_type &val) |
|
std::pair< iterator, bool > | insert (value_type &&val) |
|
iterator | insert (iterator, value_type &&val) |
|
template<typename InputIterator > |
size_type | insert (InputIterator first, InputIterator last) |
|
iterator | lower_bound (const key_type &key) |
|
const_iterator | lower_bound (const key_type &key) const |
|
rw_orderedhashmap & | operator= (const rw_orderedhashmap &rhs) |
|
rw_orderedhashmap & | operator= (rw_orderedhashmap &&rhs) |
|
mapped_type & | operator[] (const key_type &key) |
|
void | resize (size_t cap) |
|
size_type | size () const |
|
void | swap (rw_orderedhashmap &other) |
|
iterator | upper_bound (const key_type &key) |
|
const_iterator | upper_bound (const key_type &key) const |
|
|
(Note that these are not member functions.)
|
template<class K , class V , class Hash , class EQ , class A > |
bool | operator!= (const rw_orderedhashmap< K, V, Hash, EQ, A > &lhs, const rw_orderedhashmap< K, V, Hash, EQ, A > &rhs) |
|
template<class K , class V , class Hash , class EQ , class A > |
bool | operator== (const rw_orderedhashmap< K, V, Hash, EQ, A > &lhs, const rw_orderedhashmap< K, V, Hash, EQ, A > &rhs) |
|
template<class K, class V, class Hash = RWTHash<K>, class EQ = std::equal_to<K>, class A = std::allocator<std::pair<const K, V> >>
class rw_orderedhashmap< K, V, Hash, EQ, A >
Class rw_orderedhashmap maintains a collection mapping between instances of K
(the key) and V
(the value), implemented as a hash table of std::pair<const K,V> in which there may not be more than one instance of any given K
. 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_orderedhashmap provides for iterators that reference its elements. rw_orderedhashmap preserves key insertion order.
Hash
must provide a const
function that takes a single argument convertible to type K
and returns a value of type size_t
.
- Note
- Any two keys that are equivalent must hash to the same value.
Key equality is determined by an equality function of type EQ
, which takes two arguments convertible to type K
and returns a value of type bool
.
- Note
- Any two keys that are equivalent are disallowed for this container.
- Synopsis
#include <rw/stdex/orderedhashmap.h>
- Persistence
- None
template<class K , class V , class Hash , class EQ , class A >
template<typename InputIterator >
Constructs an rw_orderedhashmap containing a copy of the pair elements in the range [first, last). The rw_orderedhashmap instance has cap buckets, uses h as its hash function object, and eq as its equality function object.
InputIterator
is an input iterator type that points to elements that are convertible to value_type objects.
- Note
- If the value specified for cap is zero, the default number of buckets is used.
template<class K , class V , class Hash , class EQ , class A >
Returns true
if the container and rhs have the same number of elements, and for each value_type in lhs, there is a value_type in rhs that has a first part (the key) for which the equality function object returns true
. The second part (the value) of the pair is not compared.
template<class K , class V , class Hash , class EQ , class A >
Inserts a copy of val into the container. If an element in the container has the same key as val, an iterator to the existing element in the collection is returned with an associated status of false
. Otherwise, the value val is inserted into the collection and an iterator to the new item is returned, along with the status true
.
template<class K , class V , class Hash , class EQ , class A >
Inserts a copy of val into the container. If an element in the container has the same key as val, an iterator to the existing element in the collection is returned with an associated status of false
. Otherwise, the value val is inserted into the collection and an iterator to the new item is returned, along with the status true
.
The parameter hint is ignored.
template<class K , class V , class Hash , class EQ , class A >
Inserts val into the container. If an element in the container has the same key as val, an iterator to the existing element in the collection is returned with an associated status of false
. Otherwise, the value val is inserted into the collection and an iterator to the new item is returned, along with the status true
.
- Condition:
- This method is available only on platforms with rvalue reference support.
template<class K , class V , class Hash , class EQ , class A >
Inserts val into the container. If an element in the container has the same key as val, an iterator to the existing element in the collection is returned with an associated status of false
. Otherwise, the value val is inserted into the collection and an iterator to the new item is returned, along with the status true
.
The parameter hint is ignored.
- Condition:
- This method is available only on platforms with rvalue reference support.
template<class K , class V , class Hash , class EQ , class A >
template<typename InputIterator >
For each value in the range [first, last), inserts a copy of the value into self. If an element in the container has the same key as the value, the value is not inserted. Returns the number of elements inserted.
InputIterator
is an input iterator type that points to elements that are convertible to value_type objects.
- Note
- first and last must not be iterators into self.
template<class K , class V , class Hash , class EQ , class A >
Returns true
if lhs and rhs have the same number of elements, and for each item in lhs, there is an item in rhs whose first part (the key) compares equal according to the equality function object and whose second part (the value) compares equal according to operator==().
- Note
- If only the keys of the values need to be compared for equality, use rw_orderedhashmap::equal_by_keys() instead.