diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-07-07 17:52:33 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-07-07 17:52:33 +0200 |
| commit | 00b3c2bc9cc638fe29d8e6f18454e9a48d0db714 (patch) | |
| tree | 439dd18ada0c559f0febb61dcc8bd53f0c927b37 /include | |
| parent | 780a63c33d80a961002859c13ce79d1ec1db9216 (diff) | |
| download | Project-Tick-00b3c2bc9cc638fe29d8e6f18454e9a48d0db714.tar.gz Project-Tick-00b3c2bc9cc638fe29d8e6f18454e9a48d0db714.zip | |
Change return type of put and emplace to match std::map
Diffstat (limited to 'include')
| -rw-r--r-- | include/tag_compound.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/include/tag_compound.h b/include/tag_compound.h index acde3a1e2b..a0adf07282 100644 --- a/include/tag_compound.h +++ b/include/tag_compound.h @@ -68,19 +68,21 @@ public: * * If the given key already exists, assigns the tag to it. * Otherwise, it is inserted under the given key. - * @return true if the key did not exist + * @return a pair of the iterator to the value and a bool indicating + * whether the key did not exist */ - bool put(const std::string& key, std::unique_ptr<tag>&& t); + std::pair<iterator, bool> put(const std::string& key, std::unique_ptr<tag>&& t); /** * @brief Constructs and assigns or inserts a tag into the compound * * Constructs a new tag of type @c T with the given args and inserts * or assigns it to the given key. - * @return true if the key did not exist + * @return a pair of the iterator to the value and a bool indicating + * whether the key did not exist */ template<class T, class... Args> - bool emplace(const std::string& key, Args&&... args); + std::pair<iterator, bool> emplace(const std::string& key, Args&&... args); /** * @brief Erases a tag from the compound @@ -113,7 +115,7 @@ private: }; template<class T, class... Args> -bool tag_compound::emplace(const std::string& key, Args&&... args) +std::pair<tag_compound::iterator, bool> tag_compound::emplace(const std::string& key, Args&&... args) { return put(key, std::unique_ptr<tag>(new T(std::forward<Args>(args)...))); } |
