mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-31 03:07:35 +02:00
Fix 'std::string_view' has not been declared (issue #1967)
This commit is contained in:
@ -5,6 +5,7 @@ HEAD
|
|||||||
----
|
----
|
||||||
|
|
||||||
* Fix error `'std::string' has not been declared` (issue #1967)
|
* Fix error `'std::string' has not been declared` (issue #1967)
|
||||||
|
* Fix error `'std::string_view' has not been declared` (issue #1967)
|
||||||
|
|
||||||
v6.21.3 (2023-07-23)
|
v6.21.3 (2023-07-23)
|
||||||
-------
|
-------
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
|
// ArduinoJson - https://arduinojson.org
|
||||||
|
// Copyright © 2014-2023, Benoit BLANCHON
|
||||||
|
// MIT License
|
||||||
|
|
||||||
|
// we expect ArduinoJson.h to include <string_view>
|
||||||
|
// but we don't want it to included accidentally
|
||||||
|
#undef ARDUINO
|
||||||
|
#define ARDUINOJSON_ENABLE_STD_STREAM 0
|
||||||
|
#define ARDUINOJSON_ENABLE_STD_STRING 0
|
||||||
|
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
|
|
||||||
#include <string_view>
|
|
||||||
|
|
||||||
#if !ARDUINOJSON_ENABLE_STRING_VIEW
|
#if !ARDUINOJSON_ENABLE_STRING_VIEW
|
||||||
# error ARDUINOJSON_ENABLE_STRING_VIEW must be set to 1
|
# error ARDUINOJSON_ENABLE_STRING_VIEW must be set to 1
|
||||||
#endif
|
#endif
|
||||||
@ -19,7 +27,7 @@ TEST_CASE("string_view") {
|
|||||||
|
|
||||||
SECTION("JsonDocument::set()") {
|
SECTION("JsonDocument::set()") {
|
||||||
doc.set(std::string_view("123", 2));
|
doc.set(std::string_view("123", 2));
|
||||||
REQUIRE(doc.as<std::string>() == "12");
|
REQUIRE(doc.as<std::string_view>() == "12");
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("JsonDocument::operator[]() const") {
|
SECTION("JsonDocument::operator[]() const") {
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
# include <string>
|
# include <string>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ARDUINOJSON_ENABLE_STRING_VIEW
|
||||||
|
# include <string_view>
|
||||||
|
#endif
|
||||||
|
|
||||||
ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE
|
ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE
|
||||||
|
|
||||||
template <typename T, typename Enable>
|
template <typename T, typename Enable>
|
||||||
|
Reference in New Issue
Block a user