Added support for nullptr (closes #998)

This commit is contained in:
Benoit Blanchon
2019-05-26 11:31:51 +02:00
parent 630107ae8a
commit 2ed77d2cc3
5 changed files with 58 additions and 2 deletions

View File

@ -12,8 +12,10 @@
#if __cplusplus >= 201103L
#define ARDUINOJSON_HAS_LONG_LONG 1
#define ARDUINOJSON_HAS_NULLPTR 1
#else
#define ARDUINOJSON_HAS_LONG_LONG 0
#define ARDUINOJSON_HAS_NULLPTR 0
#endif
// Small or big machine?

View File

@ -88,6 +88,27 @@ struct Comparer<bool, void> {
void visitNull() {}
};
#if ARDUINOJSON_HAS_NULLPTR
template <>
struct Comparer<decltype(nullptr), void> {
int result;
explicit Comparer(decltype(nullptr)) : result(1) {}
void visitArray(const CollectionData &) {}
void visitObject(const CollectionData &) {}
void visitFloat(Float) {}
void visitString(const char *) {}
void visitRawJson(const char *, size_t) {}
void visitNegativeInteger(UInt) {}
void visitPositiveInteger(UInt) {}
void visitBoolean(bool) {}
void visitNull() {
result = 0;
}
};
#endif
template <typename TVariant>
class VariantComparisons {
private: