From a4441e5171be9140515e70ade83384d80315488c Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Mon, 23 Dec 2024 15:40:07 +0100 Subject: [PATCH] Replace all the `typename =` --- src/ArduinoJson/Array/JsonArray.hpp | 2 +- src/ArduinoJson/Array/Utilities.hpp | 23 +++++----- .../Deserialization/deserialize.hpp | 11 ++--- src/ArduinoJson/Document/JsonDocument.hpp | 43 +++++++++++-------- src/ArduinoJson/Object/JsonObject.hpp | 12 +++--- src/ArduinoJson/Object/JsonObjectConst.hpp | 10 ++--- src/ArduinoJson/Object/MemberProxy.hpp | 2 +- src/ArduinoJson/Strings/JsonString.hpp | 7 +-- src/ArduinoJson/Strings/StringAdapter.hpp | 2 +- src/ArduinoJson/Variant/JsonVariantConst.hpp | 12 +++--- src/ArduinoJson/Variant/VariantOperators.hpp | 14 +++--- src/ArduinoJson/Variant/VariantRefBase.hpp | 14 +++--- .../Variant/VariantRefBaseImpl.hpp | 2 +- 13 files changed, 79 insertions(+), 75 deletions(-) diff --git a/src/ArduinoJson/Array/JsonArray.hpp b/src/ArduinoJson/Array/JsonArray.hpp index 940156e32..7f02f9872 100644 --- a/src/ArduinoJson/Array/JsonArray.hpp +++ b/src/ArduinoJson/Array/JsonArray.hpp @@ -69,7 +69,7 @@ class JsonArray : public detail::VariantOperators { // Appends a value to the array. // https://arduinojson.org/v7/api/jsonarray/add/ template ::value>> + detail::enable_if_t::value, int> = 0> bool add(T* value) const { return detail::ArrayData::addValue(data_, value, resources_); } diff --git a/src/ArduinoJson/Array/Utilities.hpp b/src/ArduinoJson/Array/Utilities.hpp index 2f0638f0e..200cb66b8 100644 --- a/src/ArduinoJson/Array/Utilities.hpp +++ b/src/ArduinoJson/Array/Utilities.hpp @@ -11,8 +11,7 @@ ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE // Copies a value to a JsonVariant. // This is a degenerated form of copyArray() to stop the recursion. -template ::value>> +template ::value, int> = 0> inline bool copyArray(const T& src, JsonVariant dst) { return dst.set(src); } @@ -20,8 +19,8 @@ inline bool copyArray(const T& src, JsonVariant dst) { // Copies values from an array to a JsonArray or a JsonVariant. // https://arduinojson.org/v7/api/misc/copyarray/ template ::value>> + detail::enable_if_t< + !detail::is_base_of::value, int> = 0> inline bool copyArray(T (&src)[N], const TDestination& dst) { return copyArray(src, N, dst); } @@ -29,8 +28,8 @@ inline bool copyArray(T (&src)[N], const TDestination& dst) { // Copies values from an array to a JsonArray or a JsonVariant. // https://arduinojson.org/v7/api/misc/copyarray/ template ::value>> + detail::enable_if_t< + !detail::is_base_of::value, int> = 0> inline bool copyArray(const T* src, size_t len, const TDestination& dst) { bool ok = true; for (size_t i = 0; i < len; i++) { @@ -62,8 +61,7 @@ inline bool copyArray(const T* src, size_t len, JsonDocument& dst) { // Copies a value from a JsonVariant. // This is a degenerated form of copyArray() to stop the recursion. -template ::value>> +template ::value, int> = 0> inline size_t copyArray(JsonVariantConst src, T& dst) { dst = src.as(); return 1; @@ -102,10 +100,11 @@ inline size_t copyArray(JsonVariantConst src, char (&dst)[N]) { // Copies values from a JsonDocument to an array. // https://arduinojson.org/v7/api/misc/copyarray/ -template ::value && - detail::is_base_of::value>> +template < + typename TSource, typename T, + detail::enable_if_t::value && + detail::is_base_of::value, + int> = 0> inline size_t copyArray(const TSource& src, T& dst) { return copyArray(src.template as(), dst); } diff --git a/src/ArduinoJson/Deserialization/deserialize.hpp b/src/ArduinoJson/Deserialization/deserialize.hpp index a95049a3b..c1963a8fa 100644 --- a/src/ArduinoJson/Deserialization/deserialize.hpp +++ b/src/ArduinoJson/Deserialization/deserialize.hpp @@ -55,10 +55,11 @@ DeserializationError doDeserialize(TDestination&& dst, TReader reader, return err; } -template