|
|
| PIMap () |
| | Constructs an empty map.
|
| |
|
| PIMap (const PIMap< Key, T > &other) |
| | Copy constructor.
|
| |
|
| PIMap (PIMap< Key, T > &&other) |
| | Move constructor.
|
| |
| | PIMap (std::initializer_list< std::pair< Key, T > > init_list) |
| | Contructs map from C++11 initializer list. More...
|
| |
|
PIMap< Key, T > & | operator= (const PIMap< Key, T > &other) |
| | Assign operator.
|
| |
|
PIMap< Key, T > & | operator= (PIMap< Key, T > &&other) |
| | Assign move operator.
|
| |
|
iterator | begin () |
| | Iterator to the first element.
|
| |
|
iterator | end () |
| | Iterator to the element following the last element.
|
| |
|
reverse_iterator | rbegin () |
| | Returns a reverse iterator to the first element of the reversed array.
|
| |
|
reverse_iterator | rend () |
| | Returns a reverse iterator to the element. following the last element of the reversed array.
|
| |
| size_t | size () const |
| | Number of elements in the container. More...
|
| |
| int | size_s () const |
| | Number of elements in the container as signed value. More...
|
| |
| size_t | length () const |
| | Same as size(). More...
|
| |
| bool | isEmpty () const |
| | Checks if the container has no elements. More...
|
| |
| bool | isNotEmpty () const |
| | Checks if the container has elements. More...
|
| |
| T & | operator[] (const Key &key) |
| | Full access to element key key. More...
|
| |
| const T & | at (const Key &key) const |
| | Read only access to element by key. More...
|
| |
|
T | take (const Key &key, const T &default_=T()) |
| | Remove element with key key from the array and return it.
|
| |
|
PIMap< Key, T > & | operator<< (const PIMap< Key, T > &other) |
| | Inserts all elements in array other to this array with overwrite.
|
| |
|
bool | operator== (const PIMap< Key, T > &m) const |
| | Compare operator with array m.
|
| |
|
bool | operator!= (const PIMap< Key, T > &m) const |
| | Compare operator with array m.
|
| |
|
bool | contains (const Key &key) const |
| | Tests if element with key key exists in the array.
|
| |
|
bool | containsValue (const T &value) const |
| | Tests if element with value value exists in the array.
|
| |
|
PIMap< Key, T > & | reserve (size_t new_size) |
| | Attempts to allocate memory for at least new_size elements.
|
| |
|
PIMap< Key, T > & | remove (const Key &key) |
| | Remove element with key key from the array.
|
| |
|
PIMap< Key, T > & | removeWhere (std::function< bool(const Key &key, const T &value)> test) |
| | Remove all elements in the array passes the test implemented by the provided function test.
|
| |
|
PIMap< Key, T > & | erase (const Key &key) |
| | Same as remove().
|
| |
| PIMap< Key, T > & | clear () |
| | Clear array, remove all elements. More...
|
| |
| void | swap (PIMap< Key, T > &other) |
| | Swaps array v other with this array. More...
|
| |
| PIMap< Key, T > & | insert (const Key &key, const T &value) |
| | Inserts value value with key key in the array. More...
|
| |
| PIMap< Key, T > & | insert (const PIPair< Key, T > &pair) |
| | Inserts value pair in the array. More...
|
| |
|
T | value (const Key &key, const T &default_=T()) const |
| | Returns the value of the element by the key key or default_ if there is no such element.
|
| |
|
PIVector< T > | values () const |
| | Returns an array of values of all elements.
|
| |
|
Key | key (const T &value, const Key &default_=Key()) const |
| | Returns the key of the first element whose value matches value or default_ if there is no such element.
|
| |
|
PIVector< Key > | keys () const |
| | Returns an array of keys of all elements.
|
| |
|
void | forEach (std::function< void(const Key &key, const T &value)> f) const |
| | Execute function void f(const Key & key, const T & value) for every element in array.
|
| |
|
template<typename Key2 , typename T2 > |
| PIMap< Key2, T2 > | map (std::function< PIPair< Key2, T2 >(const Key &key, const T &value)> f) const |
| | Сreates a new map PIMap<Key2, T2> populated with the results of calling a provided function PIPair<Key2, T2> f(const Key & key, const T & value) on every element in the calling array.
|
| |
|
template<typename ST > |
| PIVector< ST > | map (std::function< ST(const Key &key, const T &value)> f) const |
| | Сreates a new array PIVector<ST> populated with the results of calling a provided function ST f(const Key & key, const T & value) on every element in the calling array.
|
| |
|
PIMap< Key, T > | filter (std::function< bool(const Key &key, const T &value)> test) const |
| | Returns a new array with all elements that pass the test implemented by the provided function bool test(const Key & key, const T & value).
|
| |
template<typename Key, typename T>
class PIMap< Key, T >
Associative array.
A collection of key/value pairs, from which you retrieve a value using its associated key. There is a finite number of keys in the map, and each key has exactly one value associated with it. value() returns value for key and leave map unchaged in any case. operator [] create entry in map if there is no entry for given key. You can retrieve all keys by method keys() and all values by methos values(). To iterate all entries use class PIMapIterator, or methods makeIterator() and makeReverseIterator(). A key in the Map may only occur once.