From b17440c12f9083d08f6d25d206a9e50aee1e869b Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 12 Jul 2019 21:05:16 +0200 Subject: [PATCH] :rotating_light: fix compiler warnings --- .../nlohmann/detail/iterators/iter_impl.hpp | 15 +++++++++++- .../nlohmann/detail/output/binary_writer.hpp | 8 +++---- single_include/nlohmann/json.hpp | 23 +++++++++++++++---- test/src/unit-regression.cpp | 2 +- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/include/nlohmann/detail/iterators/iter_impl.hpp b/include/nlohmann/detail/iterators/iter_impl.hpp index bc87de29f..f365d181f 100644 --- a/include/nlohmann/detail/iterators/iter_impl.hpp +++ b/include/nlohmann/detail/iterators/iter_impl.hpp @@ -128,6 +128,19 @@ class iter_impl iter_impl(const iter_impl& other) noexcept : m_object(other.m_object), m_it(other.m_it) {} + /*! + @brief converting assignment + @param[in] other const iterator to copy from + @return const/non-const iterator + @note It is not checked whether @a other is initialized. + */ + iter_impl& operator=(const iter_impl& other) noexcept + { + m_object = other.m_object; + m_it = other.m_it; + return *this; + } + /*! @brief converting constructor @param[in] other non-const iterator to copy from @@ -138,7 +151,7 @@ class iter_impl /*! @brief converting assignment - @param[in,out] other non-const iterator to copy from + @param[in] other non-const iterator to copy from @return const/non-const iterator @note It is not checked whether @a other is initialized. */ diff --git a/include/nlohmann/detail/output/binary_writer.hpp b/include/nlohmann/detail/output/binary_writer.hpp index a8fddfee8..f52b77874 100644 --- a/include/nlohmann/detail/output/binary_writer.hpp +++ b/include/nlohmann/detail/output/binary_writer.hpp @@ -1204,19 +1204,19 @@ class binary_writer case value_t::number_unsigned: { - if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + if (j.m_value.number_unsigned <= static_cast((std::numeric_limits::max)())) { return 'i'; } - if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + if (j.m_value.number_unsigned <= static_cast((std::numeric_limits::max)())) { return 'U'; } - if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + if (j.m_value.number_unsigned <= static_cast((std::numeric_limits::max)())) { return 'I'; } - if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + if (j.m_value.number_unsigned <= static_cast((std::numeric_limits::max)())) { return 'l'; } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 65989e024..76ae3b1d9 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -7831,6 +7831,19 @@ class iter_impl iter_impl(const iter_impl& other) noexcept : m_object(other.m_object), m_it(other.m_it) {} + /*! + @brief converting assignment + @param[in] other const iterator to copy from + @return const/non-const iterator + @note It is not checked whether @a other is initialized. + */ + iter_impl& operator=(const iter_impl& other) noexcept + { + m_object = other.m_object; + m_it = other.m_it; + return *this; + } + /*! @brief converting constructor @param[in] other non-const iterator to copy from @@ -7841,7 +7854,7 @@ class iter_impl /*! @brief converting assignment - @param[in,out] other non-const iterator to copy from + @param[in] other non-const iterator to copy from @return const/non-const iterator @note It is not checked whether @a other is initialized. */ @@ -10872,19 +10885,19 @@ class binary_writer case value_t::number_unsigned: { - if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + if (j.m_value.number_unsigned <= static_cast((std::numeric_limits::max)())) { return 'i'; } - if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + if (j.m_value.number_unsigned <= static_cast((std::numeric_limits::max)())) { return 'U'; } - if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + if (j.m_value.number_unsigned <= static_cast((std::numeric_limits::max)())) { return 'I'; } - if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + if (j.m_value.number_unsigned <= static_cast((std::numeric_limits::max)())) { return 'l'; } diff --git a/test/src/unit-regression.cpp b/test/src/unit-regression.cpp index 7836b6567..4ac9e5ee6 100644 --- a/test/src/unit-regression.cpp +++ b/test/src/unit-regression.cpp @@ -1808,4 +1808,4 @@ template class object {}; template class string {}; template class number_integer {}; template class number_unsigned {}; -template class number_float {}; \ No newline at end of file +template class number_float {};