diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp index 41146cd21..84b55f229 100644 --- a/include/nlohmann/detail/conversions/from_json.hpp +++ b/include/nlohmann/detail/conversions/from_json.hpp @@ -277,7 +277,7 @@ template < typename BasicJsonType, typename T, std::size_t... Idx > std::array from_json_inplace_array_impl(BasicJsonType&& j, identity_tag> /*unused*/, index_sequence /*unused*/) { - return { { j.at(Idx).template get < T&& > ()... } }; + return { { std::forward(j).at(Idx).template get < T&& > ()... } }; } template < typename BasicJsonType, typename T, std::size_t... Idx > diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 2db129e56..d88467d85 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -4904,7 +4904,7 @@ template < typename BasicJsonType, typename T, std::size_t... Idx > std::array from_json_inplace_array_impl(BasicJsonType&& j, identity_tag> /*unused*/, index_sequence /*unused*/) { - return { { j.at(Idx).template get < T&& > ()... } }; + return { { std::forward(j).at(Idx).template get < T&& > ()... } }; } template < typename BasicJsonType, typename T, std::size_t... Idx >