A std::map compatible map, useful when we do not have many elements (less then 512) More...
#include <tpie/tiny.h>
Public Member Functions | |
map (const Comp &comp, const Alloc &alloc=Alloc()) | |
map (const Alloc &alloc) | |
map (const map &other) | |
map (const map &other, const Alloc &alloc) | |
map (map &&other) | |
map (map &&other, const Alloc &alloc) | |
template<class InputIterator > | |
map (InputIterator first, InputIterator last, const Comp &comp=Comp(), const Alloc &alloc=Alloc()) | |
map (std::initializer_list< typename P::value_type > init, const Comp &comp=Comp(), const Alloc &alloc=Alloc()) | |
T & | operator[] (const Key &key) |
Returns a reference to the value that is mapped to a key equivalent to key, performing an insertion if such key does not already exist. More... | |
T & | operator[] (Key &&key) |
Returns a reference to the value that is mapped to a key equivalent to key, performing an insertion if such key does not already exist. More... | |
T & | at (const Key &key) |
Returns a reference to the mapped value of the element with key equivalent to key. More... | |
const T & | at (const Key &key) const |
Returns a reference to the mapped value of the element with key equivalent to key. More... | |
iterator | begin () noexcept |
Returns an iterator to the first element of the container. More... | |
const_iterator | begin () const noexcept |
Returns an iterator to the first element of the container. More... | |
const_iterator | cbegin () const noexcept |
Returns an iterator to the first element of the container. More... | |
reverse_iterator | rbegin () noexcept |
Returns a reverse iterator to the first element of the reversed container. More... | |
const_reverse_iterator | rbegin () const noexcept |
Returns a reverse iterator to the first element of the reversed container. More... | |
const_reverse_iterator | crbegin () const noexcept |
Returns a reverse iterator to the first element of the reversed container. More... | |
iterator | end () noexcept |
Returns an iterator to the element following the last element of the container. More... | |
const_iterator | end () const noexcept |
Returns an iterator to the element following the last element of the container. More... | |
const_iterator | cend () const noexcept |
Returns an iterator to the element following the last element of the container. More... | |
reverse_iterator | rend () noexcept |
Returns a reverse iterator to the element following the last element of the reversed container. More... | |
const_reverse_iterator | rend () const noexcept |
Returns a reverse iterator to the element following the last element of the reversed container. More... | |
const_reverse_iterator | crend () const noexcept |
Returns a reverse iterator to the element following the last element of the reversed container. More... | |
bool | empty () const noexcept |
Checks if the container has no elements, i.e. More... | |
size_t | size () const noexcept |
Returns the number of elements in the container, i.e. More... | |
size_t | max_size () const noexcept |
Returns the maximum number of elements the container is able to hold due to system or library implementation limitations. More... | |
void | clear () |
Removes all elements from the container. More... | |
iterator | erase (iterator pos) |
Removes the element at pos. More... | |
iterator | erase (iterator first, iterator last) |
Removes the elements in the range [first; last), which must be a valid range in *this. More... | |
size_t | erase (const T &key) |
Removes all elements with the key value key. More... | |
void | swap (set_impl &o) |
Exchanges the contents of the container with those of other. More... | |
iterator | find (const T &key) noexcept |
Finds an element with key equivalent to key. More... | |
const_iterator | find (const T &key) const noexcept |
Finds an element with key equivalent to key. More... | |
std::pair< iterator, iterator > | equal_range (const T &key) noexcept |
Returns a range containing all elements with the given key in the container. More... | |
std::pair< const_iterator, const_iterator > | equal_range (const T &key) const noexcept |
Returns a range containing all elements with the given key in the container. More... | |
iterator | lower_bound (const T &key) noexcept |
Returns an iterator pointing to the first element that is not less than key. More... | |
const_iterator | lower_bound (const T &key) const noexcept |
Returns an iterator pointing to the first element that is not less than key. More... | |
iterator | upper_bound (const T &key) noexcept |
Returns an iterator pointing to the first element that is greater than key. More... | |
const_iterator | upper_bound (const T &key) const noexcept |
Returns an iterator pointing to the first element that is greater than key. More... | |
key_compare | key_comp () const noexcept |
Returns the function object that compares the keys, which is a copy of this container's constructor argument comp. More... | |
value_compare | value_comp () const noexcept |
Returns a function object that compares objects of type std::map::value_type (key-value pairs) by using key_comp to compare the first components of the pairs. More... | |
allocator_type | get_allocator () const |
Returns the allocator associated with the container. More... | |
size_t | count (const Tk) const noexcept |
Returns the number of elements with key k. More... | |
insert_result | insert (const std::pair< Key, T > &t) |
Inserts element(s) into the container, if the container doesn't already contain an element with an equivalent key. More... | |
insert_result | insert (TT &&t) |
Inserts element(s) into the container, if the container doesn't already contain an element with an equivalent key. More... | |
insert_result | insert (const_iterator, const std::pair< Key, T > &t) |
Does the same as normal insert, we ignore the hint. More... | |
insert_result | insert (const_iterator, TT &&t) |
Does the same as normal insert, we ignore the hint. More... | |
void | insert (InputIt first, InputIt last) |
Inserts elements from range [first, last). More... | |
void | insert (std::initializer_list< value_type > list) |
Inserts elements from initializer list ilist. More... | |
insert_result | emplace (Args &&...args) |
Inserts a new element into the container by constructing it in-place with the given args if there is no element with the key in the container. More... | |
insert_result | emplace_hint (const_iterator, Args &&...args) |
Do the same as emplace, and ignore the hint. More... | |
void | reserve (size_t new_cap) |
Increase the capacity of the container to a value that's greater or equal to new_cap. More... | |
void | shrink_to_fit () |
Requests the removal of unused capacity. More... | |
size_t | capacity () const noexcept |
Returns the number of elements that the container has currently allocated space for. More... | |
Protected Types | |
typedef std::vector< std::pair < Key, T >, Alloc > | Inner |
typedef bits::SingleInsertHelp::template type< Inner > | IH |
Protected Attributes | |
value_compare | comp |
std::vector< value_type, Alloc > | inner |
A std::map compatible map, useful when we do not have many elements (less then 512)
|
inline |
Returns a reference to the mapped value of the element with key equivalent to key.
If no such element exists, an exception of type std::out_of_range is thrown.
Definition at line 720 of file tiny.h.
References tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, Comp, Alloc, bits::SingleInsertHelp >::end(), and tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, Comp, Alloc, bits::SingleInsertHelp >::lower_bound().
|
inline |
Returns a reference to the mapped value of the element with key equivalent to key.
If no such element exists, an exception of type std::out_of_range is thrown.
Definition at line 731 of file tiny.h.
References tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, Comp, Alloc, bits::SingleInsertHelp >::end(), and tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, Comp, Alloc, bits::SingleInsertHelp >::lower_bound().
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlineinherited |
|
inlinenoexceptinherited |
Returns the number of elements with key k.
Definition at line 525 of file tiny.h.
References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::end(), tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::equal_range(), and tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::lower_bound().
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlineinherited |
Inserts a new element into the container by constructing it in-place with the given args if there is no element with the key in the container.
Definition at line 607 of file tiny.h.
Referenced by tpie::tiny::map< Key, T, Comp, Alloc >::operator[]().
|
inlineinherited |
Do the same as emplace, and ignore the hint.
Definition at line 616 of file tiny.h.
References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::emplace().
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
Returns an iterator to the element following the last element of the container.
Definition at line 249 of file tiny.h.
Referenced by tpie::tiny::map< Key, T, Comp, Alloc >::at().
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
Returns a range containing all elements with the given key in the container.
The range is defined by two iterators, one pointing to the first element that is not less than key and another pointing to the first element greater than key.
|
inlinenoexceptinherited |
Returns a range containing all elements with the given key in the container.
The range is defined by two iterators, one pointing to the first element that is not less than key and another pointing to the first element greater than key.
|
inlineinherited |
|
inlineinherited |
Removes the elements in the range [first; last), which must be a valid range in *this.
Definition at line 317 of file tiny.h.
References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::begin(), and tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::size().
|
inlineinherited |
Removes all elements with the key value key.
Definition at line 327 of file tiny.h.
References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::equal_range(), and tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::erase().
|
inlinenoexceptinherited |
Finds an element with key equivalent to key.
If no such element is found, past-the-end iterator is returned.
Definition at line 347 of file tiny.h.
References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::end(), and tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::lower_bound().
|
inlinenoexceptinherited |
Finds an element with key equivalent to key.
If no such element is found, past-the-end iterator is returned.
Definition at line 357 of file tiny.h.
References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::end(), and tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::lower_bound().
|
inlineinherited |
|
inlineinherited |
Inserts element(s) into the container, if the container doesn't already contain an element with an equivalent key.
|
inlineinherited |
Inserts element(s) into the container, if the container doesn't already contain an element with an equivalent key.
Definition at line 560 of file tiny.h.
References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::emplace().
|
inlineinherited |
Does the same as normal insert, we ignore the hint.
Definition at line 567 of file tiny.h.
References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::insert().
|
inlineinherited |
Does the same as normal insert, we ignore the hint.
Definition at line 575 of file tiny.h.
References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::insert().
|
inlineinherited |
Inserts elements from range [first, last).
Definition at line 583 of file tiny.h.
References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::insert(), and tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::size().
|
inlineinherited |
Inserts elements from initializer list ilist.
Definition at line 592 of file tiny.h.
References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::insert().
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
Returns an iterator pointing to the first element that is not less than key.
Definition at line 387 of file tiny.h.
Referenced by tpie::tiny::map< Key, T, Comp, Alloc >::at().
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inline |
Returns a reference to the value that is mapped to a key equivalent to key, performing an insertion if such key does not already exist.
Definition at line 702 of file tiny.h.
|
inline |
Returns a reference to the value that is mapped to a key equivalent to key, performing an insertion if such key does not already exist.
Definition at line 711 of file tiny.h.
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlineinherited |
Increase the capacity of the container to a value that's greater or equal to new_cap.
If new_cap is greater than the current capacity(), new storage is allocated, otherwise the method does nothing.
|
inlineinherited |
|
inlinenoexceptinherited |
|
inlineinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |