47template <
typename T,
typename R,
typename Cmp = std::less < >,
typename Alloc = std::allocator < std::pair < const T, R > > >
48class map :
public std::map < T, R, Cmp, Alloc > {
53 using std::map< T, R, Cmp, Alloc >::map;
58 using std::map< T, R, Cmp, Alloc >::operator =;
93 template <
class Iterator >
101 using iterator =
typename std::map<T, R, Cmp, Alloc>::iterator;
107 using std::map< T, R, Cmp, Alloc >::insert;
118 std::pair < iterator, bool >
insert (
const T & key,
const R & value ) {
131 std::pair < iterator, bool >
insert (
const T & key, R && value ) {
144 std::pair < iterator, bool >
insert ( T && key,
const R & value ) {
157 std::pair < iterator, bool >
insert ( T && key, R && value ) {
163 R &
at (
const T & key, R & defaultValue ) {
164 auto value = this->find ( key );
165 if ( value ==
end ( ) )
168 return value->second;
171 const R &
at (
const T & key,
const R & defaultValue )
const {
172 auto value = this->find ( key );
173 if ( value ==
end ( ) )
176 return value->second;
206 return make_map_move_iterator < T, R > ( this->
begin ( ) );
236 return make_map_move_iterator < T, R > ( this->
end ( ) );
246 auto endIter =
end ( );
247 auto beginIter =
begin ( );
258 auto endIter =
end ( );
259 auto beginIter =
begin ( );
270 auto endIter = std::move ( * this ).end ( );
271 auto beginIter = std::move ( * this ).begin ( );
287 auto res = std::map < T, R, Cmp, Alloc >::equal_range ( std::forward < K > ( key ) );
303 auto res = std::map < T, R, Cmp, Alloc >::equal_range ( std::forward < K > ( key ) );
319 auto res = std::map < T, R, Cmp, Alloc >::equal_range ( std::forward < K > ( key ) );
327 using std::map < T, R, Cmp, Alloc >::erase;
341 auto iter = this->find ( key );
350 using std::map < T, R, Cmp, Alloc >::operator [];
364 auto iter = this->find ( key );
365 if ( iter ==
end ( ) ) {
366 return this->
operator [ ] ( T ( std::forward < K > ( key ) ) );
386template<
class T,
class R,
class ... Ts >
391 for(
const std::pair<const T, R>& item :
map) {
392 if(!first) out <<
", ";
394 out <<
"(" << item.first <<
", " << item.second <<
")";
Implementation of iterator_range, i.e. pair of iterators. The class provides most notably begin and e...
Definition: range.hpp:24
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
R & operator[](K &&key)
Retrieve value by key of arbitrary type.
Definition: map.hpp:363
const R & at(const T &key, const R &defaultValue) const
Definition: map.hpp:171
auto range() &
Make range of non-const begin to end iterators.
Definition: map.hpp:245
R & at(const T &key, R &defaultValue)
Definition: map.hpp:163
auto equal_range(K &&key) &
Make range of elements with key equal to the key.
Definition: map.hpp:302
map(const map &other)=default
std::pair< iterator, bool > insert(T &&key, R &&value)
Insert variant with explicit key and value parameters.
Definition: map.hpp:157
auto equal_range(K &&key) const &
Make range of elements with key equal to the key.
Definition: map.hpp:286
std::pair< iterator, bool > insert(T &&key, const R &value)
Insert variant with explicit key and value parameters.
Definition: map.hpp:144
map & operator=(map &&other)=default
auto begin() const &
Inherited behavior of begin for const instance.
Definition: map.hpp:195
auto end() &&
New variant of end for rvalues.
Definition: map.hpp:235
auto begin() &
Inherited behavior of begin for non-const instance.
Definition: map.hpp:185
auto end() const &
Inherited behavior of end for const instance.
Definition: map.hpp:225
auto equal_range(K &&key) &&
Make range of elements with key equal to the key.
Definition: map.hpp:318
auto begin() &&
New variant of begin for rvalues.
Definition: map.hpp:205
std::pair< iterator, bool > insert(const T &key, const R &value)
Insert variant with explicit key and value parameters.
Definition: map.hpp:118
std::pair< iterator, bool > insert(const T &key, R &&value)
Insert variant with explicit key and value parameters.
Definition: map.hpp:131
map(const ext::iterator_range< Iterator > &range)
Definition: map.hpp:94
auto end() &
Inherited behavior of end for non-const instance.
Definition: map.hpp:215
typename std::map< T, R, Cmp, Alloc >::iterator iterator
The iterator type is inheried.
Definition: map.hpp:101
size_t erase(const K &key)
Erase by key of arbitrary type.
Definition: map.hpp:340
auto range() &&
Make range of move begin to end iterators.
Definition: map.hpp:269
auto range() const &
Make range of non-const begin to end iterators.
Definition: map.hpp:257
return res
Definition: MinimizeByPartitioning.h:145
Definition: sigHandler.cpp:20
iterator_range< Iter > make_iterator_range(Iter begin, Iter end)
Helper to create iterator_range from two iterators.
Definition: range.hpp:235
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
std::ostream & operator<<(ext::reference_wrapper< std::ostream > &os, std::ostream &(*const func)(std::ostream &))
Overloaded function allowing same operations on wrapped output stream as on the actual output stream,...
Definition: GlobalData.cpp:33
auto begin(Container &&cont) -> decltype(std::forward(cont).begin())
Definition: iterator.hpp:900
void end()
Definition: measurements.cpp:19