From 86ed1883cb47189827284c3a1bd41eadf9495325 Mon Sep 17 00:00:00 2001 From: "Suad Halilovic (Sudo)" Date: Sun, 2 Aug 2020 17:06:45 +0200 Subject: [PATCH] 2020/08/02, empty() instead of size() compare to 0 --- include/nlohmann/detail/conversions/to_json.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index b45004fd4..62a82b47d 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -175,7 +175,7 @@ struct external_constructor j.m_type = value_t::array; j.m_value = value_t::array; j.m_value.array->resize(arr.size()); - if (arr.size() > 0) + if (!arr.empty()) { std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin()); } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 41c171117..9c4e4a515 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -4164,7 +4164,7 @@ struct external_constructor j.m_type = value_t::array; j.m_value = value_t::array; j.m_value.array->resize(arr.size()); - if (arr.size() > 0) + if (!arr.empty()) { std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin()); }