From 691fb0c57a142889f788c72e8b7d64548cb5b06c Mon Sep 17 00:00:00 2001 From: chenguoping Date: Tue, 16 Jun 2020 15:35:26 +0800 Subject: [PATCH 1/3] fix issue#2059 --- include/nlohmann/detail/iterators/iteration_proxy.hpp | 3 ++- single_include/nlohmann/json.hpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/iterators/iteration_proxy.hpp b/include/nlohmann/detail/iterators/iteration_proxy.hpp index c61d96296c..48927b0183 100644 --- a/include/nlohmann/detail/iterators/iteration_proxy.hpp +++ b/include/nlohmann/detail/iterators/iteration_proxy.hpp @@ -12,7 +12,8 @@ namespace nlohmann { namespace detail { -template +template::value, int>::type = 0> void int_to_string( string_type& target, std::size_t value ) { target = std::to_string(value); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index cc822a543b..69a4ec0921 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3650,7 +3650,8 @@ namespace nlohmann { namespace detail { -template +template::value, int>::type = 0> void int_to_string( string_type& target, std::size_t value ) { target = std::to_string(value); From aeef50709e6a49f5807cdf787473ca8adecbe23c Mon Sep 17 00:00:00 2001 From: chenguoping Date: Mon, 22 Jun 2020 20:17:56 +0800 Subject: [PATCH 2/3] to allow for ADL in int_to_string() function --- include/nlohmann/detail/iterators/iteration_proxy.hpp | 4 +++- single_include/nlohmann/json.hpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/iterators/iteration_proxy.hpp b/include/nlohmann/detail/iterators/iteration_proxy.hpp index 48927b0183..d19be4ddd6 100644 --- a/include/nlohmann/detail/iterators/iteration_proxy.hpp +++ b/include/nlohmann/detail/iterators/iteration_proxy.hpp @@ -16,7 +16,9 @@ template::value, int>::type = 0> void int_to_string( string_type& target, std::size_t value ) { - target = std::to_string(value); + // For ADL + using std::to_string; + target = to_string(value); } template class iteration_proxy_value { diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 69a4ec0921..58b12a7df1 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3654,7 +3654,9 @@ template::value, int>::type = 0> void int_to_string( string_type& target, std::size_t value ) { - target = std::to_string(value); + // For ADL + using std::to_string; + target = to_string(value); } template class iteration_proxy_value { From 0ecf297457272a887a454508bb66610e9156a920 Mon Sep 17 00:00:00 2001 From: chenguoping Date: Tue, 23 Jun 2020 09:14:55 +0800 Subject: [PATCH 3/3] drop std::enable_if part --- include/nlohmann/detail/iterators/iteration_proxy.hpp | 3 +-- single_include/nlohmann/json.hpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/nlohmann/detail/iterators/iteration_proxy.hpp b/include/nlohmann/detail/iterators/iteration_proxy.hpp index d19be4ddd6..7d0f1e5910 100644 --- a/include/nlohmann/detail/iterators/iteration_proxy.hpp +++ b/include/nlohmann/detail/iterators/iteration_proxy.hpp @@ -12,8 +12,7 @@ namespace nlohmann { namespace detail { -template::value, int>::type = 0> +template void int_to_string( string_type& target, std::size_t value ) { // For ADL diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 58b12a7df1..a6f9af99bf 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3650,8 +3650,7 @@ namespace nlohmann { namespace detail { -template::value, int>::type = 0> +template void int_to_string( string_type& target, std::size_t value ) { // For ADL