Replace Yes/No with int/char

This commit is contained in:
Benoit Blanchon
2022-11-22 18:56:42 +01:00
parent 079ccadbee
commit 6447520b5b
5 changed files with 15 additions and 30 deletions

View File

@@ -307,15 +307,12 @@ inline bool canConvertFromJson(VariantConstRef src, const std::string_view&) {
template <typename T>
struct ConverterNeedsWriteableRef {
protected: // <- to avoid GCC's "all member functions in class are private"
typedef char Yes[1];
typedef char No[2];
static Yes& probe(T (*f)(VariantRef));
static No& probe(T (*f)(VariantConstRef));
static int probe(T (*f)(VariantRef));
static char probe(T (*f)(VariantConstRef));
public:
static const bool value =
sizeof(probe(Converter<T>::fromJson)) == sizeof(Yes);
sizeof(probe(Converter<T>::fromJson)) == sizeof(int);
};
} // namespace ARDUINOJSON_NAMESPACE