diff options
| -rw-r--r-- | include/value.h | 1 | ||||
| -rw-r--r-- | src/value.cpp | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/value.h b/include/value.h index 5076bb4ed5..c029e1ecad 100644 --- a/include/value.h +++ b/include/value.h @@ -115,6 +115,7 @@ public: * @sa tag_compound::operator[] */ value& operator[](const std::string& key); + value& operator[](const char* key); //need this overload because of conflict with built-in operator[] 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 c1a7a91e2b..bf75b8931b 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -351,6 +351,11 @@ value& value::operator[](const std::string& key) return dynamic_cast<tag_compound&>(*tag_)[key]; } +value& value::operator[](const char* key) +{ + return (*this)[std::string(key)]; +} + std::unique_ptr<tag>& value::get_ptr() { return tag_; |
