|
|
| 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 last map entry.
|
| |
|
reverse_iterator | rend () |
| | Returns a reverse iterator to the position before the first map entry.
|
| |
| size_t | size () const |
| | Number of entries in the map. More...
|
| |
| int | size_s () const |
| | Number of entries in the map as a signed value. More...
|
| |
| size_t | length () const |
| | Same as size(). More...
|
| |
| bool | isEmpty () const |
| | Checks whether the map is empty. More...
|
| |
| bool | isNotEmpty () const |
| | Checks whether the map contains entries. 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()) |
| | Removes entry with key key and returns its value.
|
| |
|
PIMap< Key, T > & | operator<< (const PIMap< Key, T > &other) |
| | Inserts all entries from other, overwriting existing keys.
|
| |
|
bool | operator== (const PIMap< Key, T > &m) const |
| | Compares this map with m.
|
| |
|
bool | operator!= (const PIMap< Key, T > &m) const |
| | Compares this map with m.
|
| |
|
bool | contains (const Key &key) const |
| | Checks whether the map contains key key.
|
| |
|
bool | containsValue (const T &value) const |
| | Checks whether the map contains value value.
|
| |
|
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) |
| | Removes entry with key key.
|
| |
|
PIMap< Key, T > & | removeWhere (std::function< bool(const Key &key, const T &value)> test) |
| | Removes all entries passes the test implemented by the provided function test.
|
| |
|
PIMap< Key, T > & | erase (const Key &key) |
| | Same as remove().
|
| |
| PIMap< Key, T > & | clear () |
| | Clears the map. More...
|
| |
| void | swap (PIMap< Key, T > &other) |
| | Swaps this map with other. More...
|
| |
| PIMap< Key, T > & | insert (const Key &key, const T &value) |
| | Inserts value value for key key. More...
|
| |
| PIMap< Key, T > & | insert (const PIPair< Key, T > &pair) |
| | Inserts entry pair. 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 values of all map entries.
|
| |
|
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 keys of all map entries.
|
| |
|
void | forEach (std::function< void(const Key &key, const T &value)> f) const |
| | Calls f for every map entry.
|
| |
|
template<typename Key2 , typename T2 > |
| PIMap< Key2, T2 > | map (std::function< PIPair< Key2, T2 >(const Key &key, const T &value)> f) const |
| | Creates a new PIMap from results of applying f to each map entry.
|
| |
|
template<typename ST > |
| PIVector< ST > | map (std::function< ST(const Key &key, const T &value)> f) const |
| | Creates a new PIVector from results of applying f to each map entry.
|
| |
|
PIMap< Key, T > | filter (std::function< bool(const Key &key, const T &value)> test) const |
| | Returns a new map with all entries 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 >
Map of unique keys and associated values.
Stores key/value pairs and keeps keys unique. value() returns the value for a key or the provided default, while operator[] creates a default value for a missing key. Use keys() and values() to retrieve map contents, and makeIterator() or makeReverseIterator() to traverse entries.