From 080cfead2872ead86f050a9cf39cc4ec04576c66 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 15 May 2026 10:22:04 +0200 Subject: [PATCH] :recycle: remove unnecessary if Signed-off-by: Niels Lohmann --- include/nlohmann/detail/conversions/to_json.hpp | 5 +---- single_include/nlohmann/json.hpp | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index 3626593d3..23e15b004 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 65b3b3459..04f4594d6 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -6023,10 +6023,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(); }