Remove explicit exclusion of as<char*>() and as<char>() (#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`.
This commit is contained in:
Benoit Blanchon
2023-01-18 22:08:42 +01:00
parent bf93779b4f
commit b350a96643
2 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,13 @@
ArduinoJson: change log
=======================
HEAD
----
* Remove explicit exclusion of `as<char*>()` and `as<char>()` (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)
-------

View File

@ -46,10 +46,8 @@ class VariantRefBase : public VariantTag {
// Casts the value to the specified type.
// https://arduinojson.org/v6/api/jsonvariant/as/
template <typename T>
FORCE_INLINE typename enable_if<!is_same<T, char*>::value &&
!is_same<T, char>::value &&
!ConverterNeedsWriteableRef<T>::value,
T>::type
FORCE_INLINE
typename enable_if<!ConverterNeedsWriteableRef<T>::value, T>::type
as() const {
return Converter<T>::fromJson(getVariantConst());
}