mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-30 02:37:35 +02:00
Add nullptr_t
This commit is contained in:
@ -8,6 +8,8 @@
|
||||
|
||||
ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
|
||||
|
||||
using nullptr_t = decltype(nullptr);
|
||||
|
||||
template <class T>
|
||||
T&& forward(typename remove_reference<T>::type& t) noexcept {
|
||||
return static_cast<T&&>(t);
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <ArduinoJson/Json/JsonSerializer.hpp>
|
||||
#include <ArduinoJson/Memory/StringBuilder.hpp>
|
||||
#include <ArduinoJson/Polyfills/utility.hpp>
|
||||
#include <ArduinoJson/Variant/JsonVariantConst.hpp>
|
||||
|
||||
ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE
|
||||
@ -174,11 +175,11 @@ struct Converter<SerializedValue<T>> : private detail::VariantAttorney {
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Converter<decltype(nullptr)> : private detail::VariantAttorney {
|
||||
static void toJson(decltype(nullptr), JsonVariant dst) {
|
||||
struct Converter<detail::nullptr_t> : private detail::VariantAttorney {
|
||||
static void toJson(detail::nullptr_t, JsonVariant dst) {
|
||||
detail::VariantData::setNull(getData(dst), getResourceManager(dst));
|
||||
}
|
||||
static decltype(nullptr) fromJson(JsonVariantConst) {
|
||||
static detail::nullptr_t fromJson(JsonVariantConst) {
|
||||
return nullptr;
|
||||
}
|
||||
static bool checkJson(JsonVariantConst src) {
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <ArduinoJson/Configuration.hpp>
|
||||
#include <ArduinoJson/Numbers/arithmeticCompare.hpp>
|
||||
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
||||
#include <ArduinoJson/Polyfills/utility.hpp>
|
||||
#include <ArduinoJson/Strings/StringAdapters.hpp>
|
||||
#include <ArduinoJson/Variant/JsonVariantVisitor.hpp>
|
||||
|
||||
@ -74,8 +75,8 @@ struct NullComparer : ComparerBase {
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Comparer<decltype(nullptr), void> : NullComparer {
|
||||
explicit Comparer(decltype(nullptr)) : NullComparer() {}
|
||||
struct Comparer<nullptr_t, void> : NullComparer {
|
||||
explicit Comparer(nullptr_t) : NullComparer() {}
|
||||
};
|
||||
|
||||
struct ArrayComparer : ComparerBase {
|
||||
|
Reference in New Issue
Block a user