Fix 'std::string' has not been declared (issue #1967)

Ported from 259855a87b
This commit is contained in:
Benoit Blanchon
2023-09-13 18:13:18 +02:00
parent 750d53f8c7
commit b20653ee1a
3 changed files with 18 additions and 0 deletions

View File

@ -6,6 +6,7 @@ add_executable(MiscTests
arithmeticCompare.cpp
conflicts.cpp
FloatParts.cpp
issue1967.cpp
JsonString.cpp
NoArduinoHeader.cpp
printable.cpp

View File

@ -0,0 +1,13 @@
// ArduinoJson - https://arduinojson.org
// Copyright © 2014-2023, Benoit BLANCHON
// MIT License
// we expect ArduinoJson.h to include <string>
#define ARDUINOJSON_ENABLE_STD_STRING 1
// but we don't want it to included accidentally
#undef ARDUINO
#define ARDUINOJSON_ENABLE_STD_STREAM 0
#define ARDUINOJSON_ENABLE_STRING_VIEW 0
#include <ArduinoJson.h>

View File

@ -9,6 +9,10 @@
#include <ArduinoJson/Polyfills/utility.hpp>
#include <ArduinoJson/Variant/JsonVariantConst.hpp>
#if ARDUINOJSON_ENABLE_STD_STRING
# include <string>
#endif
ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE
template <typename T, typename Enable>