Fix constness of some AnyMap functions

This commit is contained in:
Ray Speth 2018-01-23 11:19:50 -05:00
parent ed24198e63
commit e85e0e2108
3 changed files with 4 additions and 4 deletions

View file

@ -92,7 +92,7 @@ public:
AnyValue& operator=(const std::map<std::string, T> items);
template<class T>
std::map<std::string, T> asMap();
std::map<std::string, T> asMap() const;
private:
std::string demangle(const std::type_info& type) const;
@ -177,7 +177,7 @@ public:
AnyValue& operator[](const std::string& key);
AnyValue& at(const std::string& key);
const AnyValue& at(const std::string& key) const;
bool hasKey(const std::string& key) const;

View file

@ -103,7 +103,7 @@ inline AnyMap& AnyValue::as<AnyMap>() {
}
template<class T>
std::map<std::string, T> AnyValue::asMap()
std::map<std::string, T> AnyValue::asMap() const
{
std::map<std::string, T> dest;
for (const auto& item : as<AnyMap>().m_data) {

View file

@ -164,7 +164,7 @@ AnyValue& AnyMap::operator[](const std::string& key)
}
}
AnyValue& AnyMap::at(const std::string& key)
const AnyValue& AnyMap::at(const std::string& key) const
{
const auto& slash = boost::ifind_first(key, "/");
if (!slash) {