Skip to content

Commit 62dada0

Browse files
committed
🐛 fix conversion to std::valarray
closes nlohmann#1824
1 parent 7bcaba0 commit 62dada0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/nlohmann/detail/conversions/from_json.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void from_json(const BasicJsonType& j, std::valarray<T>& l)
154154
JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
155155
}
156156
l.resize(j.size());
157-
std::copy(j.m_value.array->begin(), j.m_value.array->end(), std::begin(l));
157+
std::copy(j.begin(), j.end(), std::begin(l));
158158
}
159159

160160
template <typename BasicJsonType, typename T, std::size_t N>

single_include/nlohmann/json.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3025,7 +3025,7 @@ void from_json(const BasicJsonType& j, std::valarray<T>& l)
30253025
JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
30263026
}
30273027
l.resize(j.size());
3028-
std::copy(j.m_value.array->begin(), j.m_value.array->end(), std::begin(l));
3028+
std::copy(j.begin(), j.end(), std::begin(l));
30293029
}
30303030

30313031
template <typename BasicJsonType, typename T, std::size_t N>
@@ -22605,7 +22605,7 @@ struct hash<nlohmann::json>
2260522605
/// @note: do not remove the space after '<',
2260622606
/// see https://github.com/nlohmann/json/pull/679
2260722607
template<>
22608-
struct less< ::nlohmann::detail::value_t>
22608+
struct less<::nlohmann::detail::value_t>
2260922609
{
2261022610
/*!
2261122611
@brief compare two value_t enum values

0 commit comments

Comments
 (0)