|
|
@ -51,7 +51,6 @@ |
|
|
|
@param o a value to be inserted into map @c l |
|
|
|
@param o a value to be inserted into map @c l |
|
|
|
@pre \#include <mrw/map.hxx> |
|
|
|
@pre \#include <mrw/map.hxx> |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
#ifdef MRW__OLD_PRE11_COMPILER |
|
|
|
|
|
|
|
template <typename K, typename T, class C, typename A> |
|
|
|
template <typename K, typename T, class C, typename A> |
|
|
|
std::map<K, T, C, A> operator<<(std::map<K, T, C, A> l, |
|
|
|
std::map<K, T, C, A> operator<<(std::map<K, T, C, A> l, |
|
|
|
const std::pair<K, T>& o) |
|
|
|
const std::pair<K, T>& o) |
|
|
@ -63,19 +62,6 @@ template <typename K, typename T, class C, typename A> |
|
|
|
"map element already exists"); |
|
|
|
"map element already exists"); |
|
|
|
return l; |
|
|
|
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
|
|
|
|
/** @brief extract the first value of a map
|
|
|
|
|
|
|
|
|
|
|
@ -96,22 +82,8 @@ template <typename K, typename T, class C, typename A> |
|
|
|
shortened by the shifted element |
|
|
|
shortened by the shifted element |
|
|
|
@pre \#include <mrw/map.hxx> |
|
|
|
@pre \#include <mrw/map.hxx> |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
#ifdef MRW__OLD_PRE11_COMPILER |
|
|
|
|
|
|
|
template <typename K, typename T, class C, typename A> |
|
|
|
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, |
|
|
|
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; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#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) |
|
|
|
std::pair<K, T>& o) |
|
|
|
throw(std::exception) { |
|
|
|
throw(std::exception) { |
|
|
|
typename std::map<K, T, C, A>::iterator it(l.begin()); |
|
|
|
typename std::map<K, T, C, A>::iterator it(l.begin()); |
|
|
@ -123,7 +95,6 @@ template <typename K, typename T, class C, typename A> |
|
|
|
l.erase(it); |
|
|
|
l.erase(it); |
|
|
|
return l; |
|
|
|
return l; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//@}
|
|
|
|
//@}
|
|
|
|
//@}
|
|
|
|
//@}
|
|
|
|