X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fmaputils.h;h=9a72d4d30f30e0339bec305b5589dc14e73be9d1;hb=HEAD;hp=66b4e3baf82c50d815f5bcf4ce0615729ebbf0fb;hpb=6fe08a456236d5c0f0231df2d50783d2b529b831;p=libs%2Fcore.git diff --git a/source/core/maputils.h b/source/core/maputils.h index 66b4e3b..9a72d4d 100644 --- a/source/core/maputils.h +++ b/source/core/maputils.h @@ -4,6 +4,7 @@ #include #include #include +#include "mspcore_api.h" namespace Msp { @@ -28,7 +29,7 @@ static std::string stringify_key(const T &k) try { LexicalConverter conv((Fmt())); - conv< @@ -47,7 +48,7 @@ public: runtime_error(make_what(typeid(T), MapUtilsInternal::stringify_key(k))) { } - virtual ~key_error() throw() { } + ~key_error() throw() override = default; private: static std::string make_what(const std::type_info &, const std::string &); @@ -57,7 +58,7 @@ private: template typename T::mapped_type &get_item(T &map, const typename T::key_type &key) { - typename T::iterator i = map.find(key); + auto i = map.find(key); if(i==map.end()) throw key_error(key); @@ -67,7 +68,7 @@ typename T::mapped_type &get_item(T &map, const typename T::key_type &key) template const typename T::mapped_type &get_item(const T &map, const typename T::key_type &key) { - typename T::const_iterator i = map.find(key); + auto i = map.find(key); if(i==map.end()) throw key_error(key); @@ -86,7 +87,7 @@ typename T::iterator insert_unique(T &map, const typename T::key_type &key, cons if(map.count(key)) throw key_error(key); - return map.insert(typename T::value_type(key, item)).first; + return map.insert(std::make_pair(key, item)).first; } template