mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Fixed variant.is<nullptr_t>()
This commit is contained in:
		| @@ -13,6 +13,7 @@ HEAD | ||||
|   (ArduinoJson now produces standard UTF-8 instead of CESU-8) | ||||
| * Added `measureJson`, `measureJsonPretty`, and `measureMsgPack` to `keywords.txt` | ||||
|   (This file is used for syntax highlighting in the Arduino IDE)  | ||||
| * Fixed `variant.is<nullptr_t>()` | ||||
|  | ||||
| > ### BREAKING CHANGES | ||||
| >  | ||||
|   | ||||
| @@ -26,6 +26,14 @@ TEST_CASE("nullptr") { | ||||
|  | ||||
|     REQUIRE(variant.isNull()); | ||||
|   } | ||||
|  | ||||
|   SECTION("JsonVariant.is<nullptr_t>()") { | ||||
|     variant.set(42); | ||||
|     REQUIRE(variant.is<std::nullptr_t>() == false); | ||||
|  | ||||
|     variant.clear(); | ||||
|     REQUIRE(variant.is<std::nullptr_t>() == true); | ||||
|   } | ||||
| } | ||||
|  | ||||
| TEST_CASE("Issue #1120") { | ||||
|   | ||||
| @@ -91,6 +91,16 @@ class VariantRefBase { | ||||
|   is() const { | ||||
|     return variantIsObject(_data); | ||||
|   } | ||||
| #if ARDUINOJSON_HAS_NULLPTR | ||||
|   // | ||||
|   // bool is<nullptr_t> const; | ||||
|   template <typename T> | ||||
|   FORCE_INLINE | ||||
|       typename enable_if<is_same<T, decltype(nullptr)>::value, bool>::type | ||||
|       is() const { | ||||
|     return variantIsNull(_data); | ||||
|   } | ||||
| #endif | ||||
|  | ||||
|   FORCE_INLINE bool isNull() const { | ||||
|     return variantIsNull(_data); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user