From 00b3c2bc9cc638fe29d8e6f18454e9a48d0db714 Mon Sep 17 00:00:00 2001 From: ljfa-ag Date: Tue, 7 Jul 2015 17:52:33 +0200 Subject: Change return type of put and emplace to match std::map --- include/tag_compound.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'include') 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&& t); + std::pair put(const std::string& key, std::unique_ptr&& 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 - bool emplace(const std::string& key, Args&&... args); + std::pair emplace(const std::string& key, Args&&... args); /** * @brief Erases a tag from the compound @@ -113,7 +115,7 @@ private: }; template -bool tag_compound::emplace(const std::string& key, Args&&... args) +std::pair tag_compound::emplace(const std::string& key, Args&&... args) { return put(key, std::unique_ptr(new T(std::forward(args)...))); } -- cgit 0.0.5-2-1-g0f52