diff --git a/include/yaml-cpp/node/convert.h b/include/yaml-cpp/node/convert.h index 4182bd9..78f28e3 100644 --- a/include/yaml-cpp/node/convert.h +++ b/include/yaml-cpp/node/convert.h @@ -269,11 +269,11 @@ struct convert> { return node; } - static bool decode(const Node& node, std::unordered_map& rhs) { + static std::unordered_map decode(const Node& node) { if (!node.IsMap()) - return false; + BAD_DECODE_EXCEPTION - rhs.clear(); + std::unordered_map rhs; for (const auto& element : node) #if defined(__GNUC__) && __GNUC__ < 4 // workaround for GCC 3: @@ -281,7 +281,7 @@ struct convert> { #else rhs[element.first.as()] = element.second.as(); #endif - return true; + return rhs; } };