From 62dada05caafcdc93da3ff3a583efe740bee89ab Mon Sep 17 00:00:00 2001 From: Niels Lohmann <mail@nlohmann.me> Date: Tue, 5 Nov 2019 19:28:00 +0100 Subject: [PATCH] :bug: fix conversion to std::valarray closes #1824 --- include/nlohmann/detail/conversions/from_json.hpp | 2 +- single_include/nlohmann/json.hpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp index 224fb33f..c389dca7 100644 --- a/include/nlohmann/detail/conversions/from_json.hpp +++ b/include/nlohmann/detail/conversions/from_json.hpp @@ -154,7 +154,7 @@ void from_json(const BasicJsonType& j, std::valarray<T>& l) JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); } l.resize(j.size()); - std::copy(j.m_value.array->begin(), j.m_value.array->end(), std::begin(l)); + std::copy(j.begin(), j.end(), std::begin(l)); } template <typename BasicJsonType, typename T, std::size_t N> diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 891cab99..e02699e3 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3025,7 +3025,7 @@ void from_json(const BasicJsonType& j, std::valarray<T>& l) JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); } l.resize(j.size()); - std::copy(j.m_value.array->begin(), j.m_value.array->end(), std::begin(l)); + std::copy(j.begin(), j.end(), std::begin(l)); } template <typename BasicJsonType, typename T, std::size_t N> @@ -22605,7 +22605,7 @@ struct hash<nlohmann::json> /// @note: do not remove the space after '<', /// see https://github.com/nlohmann/json/pull/679 template<> -struct less< ::nlohmann::detail::value_t> +struct less<::nlohmann::detail::value_t> { /*! @brief compare two value_t enum values