Skip to content

Commit

Permalink
Make string support even more generic
Browse files Browse the repository at this point in the history
Closes #2084
  • Loading branch information
d-a-v authored and bblanchon committed May 1, 2024
1 parent c99af48 commit 57354de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ HEAD
----

* Improve error messages when using `char` or `char*` (issue #2043)
* Make string support even more generic (PR #2084 by @d-a-v)

v6.21.5 (2024-01-10)
-------
Expand Down
7 changes: 3 additions & 4 deletions src/ArduinoJson/Strings/StringTraits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 57354de

Please sign in to comment.