diff --git a/include/yaml-cpp/node/convert.h b/include/yaml-cpp/node/convert.h index e3547dd..f232de7 100644 --- a/include/yaml-cpp/node/convert.h +++ b/include/yaml-cpp/node/convert.h @@ -254,10 +254,9 @@ struct convert> { } static bool decode(const Node& node, std::array& rhs) { - if (!node.IsSequence()) + if (!isNodeValid(node)) { return false; - if (node.size() != N) - return false; + } for (auto i = 0u; i < node.size(); ++i) { #if defined(__GNUC__) && __GNUC__ < 4 @@ -269,6 +268,12 @@ struct convert> { } return true; } + +private: + + static bool isNodeValid(const Node& node) { + return node.IsSequence() && node.size() == N; + } }; // std::pair