diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index 0e0fb4655..aef1b1a25 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -214,10 +214,7 @@ struct external_constructor j.m_data.m_type = value_t::array; j.m_data.m_value = value_t::array; j.m_data.m_value.array->resize(arr.size()); - if (arr.size() > 0) - { - std::copy(std::begin(arr), std::end(arr), j.m_data.m_value.array->begin()); - } + std::copy(std::begin(arr), std::end(arr), j.m_data.m_value.array->begin()); j.set_parents(); j.assert_invariant(); } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index dec481118..2facfbdf8 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -6220,10 +6220,7 @@ struct external_constructor j.m_data.m_type = value_t::array; j.m_data.m_value = value_t::array; j.m_data.m_value.array->resize(arr.size()); - if (arr.size() > 0) - { - std::copy(std::begin(arr), std::end(arr), j.m_data.m_value.array->begin()); - } + std::copy(std::begin(arr), std::end(arr), j.m_data.m_value.array->begin()); j.set_parents(); j.assert_invariant(); }