Skip to content

Commit

Permalink
Fix 'std::string' has not been declared (issue #1967)
Browse files Browse the repository at this point in the history
Ported from 259855a
  • Loading branch information
bblanchon committed Sep 13, 2023
1 parent 750d53f commit b20653e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions extras/tests/Misc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ add_executable(MiscTests
arithmeticCompare.cpp
conflicts.cpp
FloatParts.cpp
issue1967.cpp
JsonString.cpp
NoArduinoHeader.cpp
printable.cpp
Expand Down
13 changes: 13 additions & 0 deletions extras/tests/Misc/issue1967.cpp
Original file line number Diff line number Diff line change
@@ -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>
4 changes: 4 additions & 0 deletions src/ArduinoJson/Variant/ConverterImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit b20653e

Please sign in to comment.