diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp index 566301616..530f3a091 100644 --- a/include/nlohmann/detail/conversions/from_json.hpp +++ b/include/nlohmann/detail/conversions/from_json.hpp @@ -395,8 +395,14 @@ std::tuple from_json_tuple_impl_base(BasicJsonType&& j, index_sequence< template < typename BasicJsonType, class A1, class A2 > std::pair from_json_tuple_impl(BasicJsonType&& j, identity_tag> /*unused*/, priority_tag<0> /*unused*/) { - return {std::forward(j).at(0).template get(), - std::forward(j).at(1).template get()}; + return {std::forward(j).at(0).template get < A1&& > (), + std::forward(j).at(1).template get < A2&& > ()}; +} + +template < typename BasicJsonType, class A1, class A2 > +std::pair from_json_tuple_impl(const BasicJsonType& j, identity_tag> /*unused*/, priority_tag<0> /*unused*/) +{ + return {j.at(0).template get(), j.at(1).template get()}; } template diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 5703f0d5a..a3203d8f9 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -5022,8 +5022,14 @@ std::tuple from_json_tuple_impl_base(BasicJsonType&& j, index_sequence< template < typename BasicJsonType, class A1, class A2 > std::pair from_json_tuple_impl(BasicJsonType&& j, identity_tag> /*unused*/, priority_tag<0> /*unused*/) { - return {std::forward(j).at(0).template get(), - std::forward(j).at(1).template get()}; + return {std::forward(j).at(0).template get < A1&& > (), + std::forward(j).at(1).template get < A2&& > ()}; +} + +template < typename BasicJsonType, class A1, class A2 > +std::pair from_json_tuple_impl(const BasicJsonType& j, identity_tag> /*unused*/, priority_tag<0> /*unused*/) +{ + return {j.at(0).template get(), j.at(1).template get()}; } template