#include <stdexcept>
#include <typeinfo>
#include <msp/strings/lexicalcast.h>
+#include "mspcore_api.h"
namespace Msp {
try
{
LexicalConverter conv((Fmt()));
- conv<<k;
+ conv << k;
return conv.get();
}
catch(const lexical_error &)
} // namespace Internal
-class key_error: public std::runtime_error
+class MSPCORE_API key_error: public std::runtime_error
{
public:
template<typename T>
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 &);
template<typename T>
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);
template<typename T>
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);
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<typename T>