|
|
|
@ -51,7 +51,6 @@ |
|
|
|
|
@param o a value to be inserted into map @c l |
|
|
|
|
@pre \#include <mrw/map.hxx> |
|
|
|
|
*/ |
|
|
|
|
#ifdef MRW__OLD_PRE11_COMPILER |
|
|
|
|
template <typename K, typename T, class C, typename A> |
|
|
|
|
std::map<K, T, C, A> operator<<(std::map<K, T, C, A> l, |
|
|
|
|
const std::pair<K, T>& o) |
|
|
|
@ -63,19 +62,6 @@ template <typename K, typename T, class C, typename A> |
|
|
|
|
"map element already exists"); |
|
|
|
|
return l; |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
template <typename K, typename T, class C, typename A> |
|
|
|
|
std::map<K, T, C, A>&& operator<<(std::map<K, T, C, A>&& l, |
|
|
|
|
const std::pair<K, T>& o) |
|
|
|
|
throw(std::exception) { |
|
|
|
|
if (!l.insert(o).second) |
|
|
|
|
throw mrw::invalid_argument(std::string(__FILE__ ":")+__LINE__+ |
|
|
|
|
": std::map<>&" |
|
|
|
|
" operator<<(std::map<>&, const T&)," |
|
|
|
|
"map element already exists"); |
|
|
|
|
return l; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/** @brief extract the first value of a map
|
|
|
|
|
|
|
|
|
@ -96,9 +82,9 @@ template <typename K, typename T, class C, typename A> |
|
|
|
|
shortened by the shifted element |
|
|
|
|
@pre \#include <mrw/map.hxx> |
|
|
|
|
*/ |
|
|
|
|
#ifdef MRW__OLD_PRE11_COMPILER |
|
|
|
|
template <typename K, typename T, class C, typename A> |
|
|
|
|
std::map<K, T, C, A> operator>>(std::map<K, T, C, A> l, std::pair<K, T>& o) |
|
|
|
|
std::map<K, T, C, A>& operator>>(std::map<K, T, C, A>& l, |
|
|
|
|
std::pair<K, T>& o) |
|
|
|
|
throw(std::exception) { |
|
|
|
|
typename std::map<K, T, C, A>::iterator it(l.begin()); |
|
|
|
|
if (it==l.end()) |
|
|
|
@ -109,21 +95,6 @@ template <typename K, typename T, class C, typename A> |
|
|
|
|
l.erase(it); |
|
|
|
|
return l; |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
template <typename K, typename T, class C, typename A> |
|
|
|
|
std::map<K, T, C, A>&& operator>>(std::map<K, T, C, A>&& l, |
|
|
|
|
std::pair<K, T>& o) |
|
|
|
|
throw(std::exception) { |
|
|
|
|
typename std::map<K, T, C, A>::iterator it(l.begin()); |
|
|
|
|
if (it==l.end()) |
|
|
|
|
throw mrw::length_error(std::string(__FILE__ ":")+__LINE__+ |
|
|
|
|
": std::map<>& operator>>(std::map<>&, T&)," |
|
|
|
|
" map is empty"); |
|
|
|
|
o = *it; |
|
|
|
|
l.erase(it); |
|
|
|
|
return l; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
//@}
|
|
|
|
|
//@}
|
|
|
|
|