From b350a9664370f37654a406d75f99b1e5b3a2d637 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Wed, 18 Jan 2023 22:08:42 +0100 Subject: [PATCH] Remove explicit exclusion of `as()` and `as()` (#1860) If you try to call them, you'll now get the same error message as any unsupported type. You could also add a custom converter for `char*` and `char`. --- CHANGELOG.md | 7 +++++++ src/ArduinoJson/Variant/VariantRefBase.hpp | 8 +++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0125a95..408828fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ ArduinoJson: change log ======================= +HEAD +---- + +* Remove explicit exclusion of `as()` and `as()` (issue #1860) + If you try to call them, you'll now get the same error message as any unsupported type. + You could also add a custom converter for `char*` and `char`. + v6.20.0 (2022-12-26) ------- diff --git a/src/ArduinoJson/Variant/VariantRefBase.hpp b/src/ArduinoJson/Variant/VariantRefBase.hpp index ddfcf0d6..c2df2dc6 100644 --- a/src/ArduinoJson/Variant/VariantRefBase.hpp +++ b/src/ArduinoJson/Variant/VariantRefBase.hpp @@ -46,11 +46,9 @@ class VariantRefBase : public VariantTag { // Casts the value to the specified type. // https://arduinojson.org/v6/api/jsonvariant/as/ template - FORCE_INLINE typename enable_if::value && - !is_same::value && - !ConverterNeedsWriteableRef::value, - T>::type - as() const { + FORCE_INLINE + typename enable_if::value, T>::type + as() const { return Converter::fromJson(getVariantConst()); }