1
0
mirror of https://github.com/nlohmann/json synced 2024-11-22 20:10:06 +00:00

🐛 fix conversion to std::valarray

closes #1824
This commit is contained in:
Niels Lohmann 2019-11-05 19:28:00 +01:00
parent 7bcaba0ca9
commit 62dada05ca
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
2 changed files with 3 additions and 3 deletions

View File

@ -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>

View File

@ -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