Improve condition

This commit is contained in:
Vincent Cogne 2016-06-09 16:06:49 +02:00
parent 13fa86fee3
commit 983a0a6bbb

View File

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