summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/value.h1
-rw-r--r--src/value.cpp15
2 files changed, 15 insertions, 1 deletions
diff --git a/include/value.h b/include/value.h
index 3b03cc0d43..a46d79e7c5 100644
--- a/include/value.h
+++ b/include/value.h
@@ -120,7 +120,6 @@ public:
* @sa tag_compound::operator[]
*/
value& operator[](const std::string& key);
- const value& operator[](const std::string& key) const;
std::unique_ptr<tag>& get_ptr();
const std::unique_ptr<tag>& get_ptr() const;
diff --git a/src/value.cpp b/src/value.cpp
index 90a67b79f3..8196ce16e2 100644
--- a/src/value.cpp
+++ b/src/value.cpp
@@ -314,6 +314,21 @@ value::operator bool() const
return tag_ != nullptr;
}
+value& value::at(const std::string& key)
+{
+ return dynamic_cast<tag_compound&>(*tag_).at(key);
+}
+
+const value& value::at(const std::string& key) const
+{
+ return dynamic_cast<const tag_compound&>(*tag_).at(key);
+}
+
+value& value::operator[](const std::string& key)
+{
+ return dynamic_cast<tag_compound&>(*tag_)[key];
+}
+
std::unique_ptr<tag>& value::get_ptr()
{
return tag_;