Skip to content

Commit 82de20e

Browse files
d-a-vbblanchon
authored andcommitted
Make string support even more generic
Ported from 57354de Closes #2084
1 parent ece4d03 commit 82de20e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ArduinoJson: change log
33

44
* Add `ARDUINOJSON_STRING_LENGTH_SIZE` to the namespace name
55
* Add MsgPack bin8/bin16/bin32 support (PR #2078 by @Sanae6)
6+
* Make string support even more generic (PR #2084 by @d-a-v)
67

78
v7.0.4 (2024-03-12)
89
------

src/ArduinoJson/Strings/StringTraits.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,15 @@ struct has_data<T,
3838
const char*>::value>::type>
3939
: true_type {};
4040

41-
// size_t length() const
41+
// unsigned int length() const
4242
// - String
4343

4444
template <class T, class = void>
4545
struct has_length : false_type {};
4646

4747
template <class T>
48-
struct has_length<
49-
T, typename enable_if<
50-
is_same<decltype(declval<const T>().length()), size_t>::value>::type>
48+
struct has_length<T, typename enable_if<is_unsigned<
49+
decltype(declval<const T>().length())>::value>::type>
5150
: true_type {};
5251

5352
// size_t size() const

0 commit comments

Comments
 (0)