From 33abccf8476cb6e4f330a3728ffd61fe24e5fb39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20DELRIEU?= Date: Tue, 8 Nov 2016 13:16:14 +0100 Subject: [PATCH] add template arguments for JSONSerializer --- src/json.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 8dc9b383d..bd59e83b6 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -214,8 +214,9 @@ inline namespace constexpr auto const& from_json = _static_const::value; } -// default JSONSerializer template argument +// default JSONSerializer template argument, doesn't care about template argument // will use ADL for serialization +template struct adl_serializer { template >::value>> @@ -328,7 +329,7 @@ template < class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template class AllocatorType = std::allocator, - class JSONSerializer = adl_serializer + template class JSONSerializer = adl_serializer > class basic_json { @@ -1398,9 +1399,9 @@ class basic_json } // constructor chosen when JSONSerializer::to_json exists for type T - template >()))> + template >::to_json(std::declval>()))> explicit basic_json(T &&val) - : basic_json(JSONSerializer::to_json(std::forward(val))) {} + : basic_json(JSONSerializer>::to_json(std::forward(val))) {} /*! @brief create a string (explicit) @@ -3072,10 +3073,10 @@ class basic_json } template >::value, float>> - auto get() const -> remove_reference_t()), std::declval())> + auto get() const -> remove_reference_t>::from_json(*this, std::declval()), std::declval())> { uncvref_t ret; - JSONSerializer::from_json(*this, ret); + JSONSerializer>::from_json(*this, ret); return ret; }