1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-25 13:41:56 +03:00

fix from_json implementation for pair/tuple

Introduced by 6e4910d5c5

Fixes #707
This commit is contained in:
Théo DELRIEU
2017-08-22 23:40:10 +02:00
committed by Théo DELRIEU
parent e45eaf6e30
commit bb1b4c934e
2 changed files with 7 additions and 5 deletions

View File

@ -1235,16 +1235,16 @@ void from_json(const BasicJsonType& j, ArithmeticType& val)
}
}
template<typename BasicJsonType, typename... Args>
void from_json(const BasicJsonType& j, std::pair<Args...>& p)
template<typename BasicJsonType, typename A1, typename A2>
void from_json(const BasicJsonType& j, std::pair<A1, A2>& p)
{
p = {j.at(0), j.at(1)};
p = {j.at(0).template get<A1>(), j.at(1).template get<A2>()};
}
template<typename BasicJsonType, typename Tuple, std::size_t... Idx>
void from_json_tuple_impl(const BasicJsonType& j, Tuple& t, index_sequence<Idx...>)
{
t = std::make_tuple(j.at(Idx)...);
t = std::make_tuple(j.at(Idx).template get<typename std::tuple_element<Idx, Tuple>::type>()...);
}
template<typename BasicJsonType, typename... Args>