Browse Source

Make string support even more generic

Closes #2084
David Gauchard 1 year ago
parent
commit
57354de831
2 changed files with 4 additions and 4 deletions
  1. 1 0
      CHANGELOG.md
  2. 3 4
      src/ArduinoJson/Strings/StringTraits.hpp

+ 1 - 0
CHANGELOG.md

@@ -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)
 -------

+ 3 - 4
src/ArduinoJson/Strings/StringTraits.hpp

@@ -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