Make string support even more generic

Ported from 57354de831
Closes #2084
This commit is contained in:
David Gauchard
2024-05-01 13:59:55 +02:00
committed by Benoit Blanchon
parent ece4d030a8
commit 82de20ee14
2 changed files with 4 additions and 4 deletions

View File

@ -3,6 +3,7 @@ ArduinoJson: change log
* Add `ARDUINOJSON_STRING_LENGTH_SIZE` to the namespace name
* Add MsgPack bin8/bin16/bin32 support (PR #2078 by @Sanae6)
* Make string support even more generic (PR #2084 by @d-a-v)
v7.0.4 (2024-03-12)
------

View File

@ -38,16 +38,15 @@ struct has_data<T,
const char*>::value>::type>
: true_type {};
// size_t length() const
// unsigned int length() const
// - String
template <class T, class = void>
struct has_length : false_type {};
template <class T>
struct has_length<
T, typename enable_if<
is_same<decltype(declval<const T>().length()), size_t>::value>::type>
struct has_length<T, typename enable_if<is_unsigned<
decltype(declval<const T>().length())>::value>::type>
: true_type {};
// size_t size() const