a map extension implementing python's dict-like interfaces.
More...
#include <proton/map.hpp>
Inherits std::map< K, T >.
List of all members.
Public Member Functions |
template<typename... argT> |
| map_ (argT &&...a) |
| forwarding ctor.
|
| map_ (std::initializer_list< itemT > a) |
| initializer_list forwarding ctor.
|
| map_ (const map_ &x) |
| copy ctor.
|
| map_ (map_ &&x) noexcept |
| move ctor.
|
map_ & | operator= (const map_ &x) |
| assign.
|
| operator baseT & () |
| cast to std::set<>&.
|
void | del (const K &key) |
| remove an item.
|
T | get (const K &key) const |
| get an item from the map.
|
template<typename... D> |
T | get (const K &key, D &&...dft) const |
| get an item from the map.
|
bool | has_key (const K &key) const |
| deprecated, using has()
|
T | pop (const K &key) |
| pop an item from the map.
|
template<typename... D> |
T | pop (const K &key, D &&...dft) |
| pop an item from the map.
|
itemT | popitem () |
| pop the first item.
|
template<typename... D> |
const T & | setdefault (const K &key, D &&...dft) |
| If key exists, return its value.
|
template<typename oT > |
void | update (oT &&o) |
| Update the map with the key/value pairs from other, overwriting existing keys.
|
Additional Inherited Members |
K | keys |
| STL member.
|
T | elements |
| STL member.
|
Detailed Description
template<typename K, typename T, typename C = std::less<K>, typename A = smart_allocator<std::pair<const K,T> >>
class proton::map_< K, T, C, A >
a map extension implementing python's dict-like interfaces.
Definition at line 80 of file map.hpp.
Member Function Documentation
template<typename K , typename T , typename C = std::less<K>, typename A = smart_allocator<std::pair<const K,T> >>
remove an item.
- Parameters:
-
- Exceptions:
-
std::out_of_range | if there is no such a value. |
Definition at line 163 of file map.hpp.
template<typename K , typename T , typename C = std::less<K>, typename A = smart_allocator<std::pair<const K,T> >>
get an item from the map.
- Parameters:
-
- Returns:
- the corresponding value.
- Exceptions:
-
std::out_of_range | if there is no such a key. |
Definition at line 177 of file map.hpp.
References proton::at().
template<typename K , typename T , typename C = std::less<K>, typename A = smart_allocator<std::pair<const K,T> >>
template<typename... D>
T proton::map_< K, T, C, A >::get |
( |
const K & |
key, |
|
|
D &&... |
dft |
|
) |
| const |
|
inline |
get an item from the map.
- Parameters:
-
key | the key of the item |
dft | the default value |
- Returns:
- the corresponding value, if the key doesn't exist, return the default.
Definition at line 188 of file map.hpp.
template<typename K , typename T , typename C = std::less<K>, typename A = smart_allocator<std::pair<const K,T> >>
pop an item from the map.
- Parameters:
-
- Returns:
- the corresponding value.
- Exceptions:
-
Definition at line 210 of file map.hpp.
References PROTON_THROW_IF.
template<typename K , typename T , typename C = std::less<K>, typename A = smart_allocator<std::pair<const K,T> >>
template<typename... D>
T proton::map_< K, T, C, A >::pop |
( |
const K & |
key, |
|
|
D &&... |
dft |
|
) |
| |
|
inline |
pop an item from the map.
- Parameters:
-
key | the key of the item |
dft | the default value |
- Returns:
- the corresponding value, if the key doesn't exist, return the default.
Definition at line 225 of file map.hpp.
template<typename K , typename T , typename C = std::less<K>, typename A = smart_allocator<std::pair<const K,T> >>
template<typename K , typename T , typename C = std::less<K>, typename A = smart_allocator<std::pair<const K,T> >>
template<typename... D>
const T& proton::map_< K, T, C, A >::setdefault |
( |
const K & |
key, |
|
|
D &&... |
dft |
|
) |
| |
|
inline |
If key exists, return its value.
If not, insert key with a value of default and return default.
Definition at line 250 of file map.hpp.
The documentation for this class was generated from the following file:
- D:/projects/gcc/libproton/include/proton/map.hpp