⚗️ use proper header for filesystem
This commit is contained in:
parent
c33bac8352
commit
930e2cf418
@ -53,4 +53,4 @@ else()
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE CXX_VERSION_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
string(REGEX REPLACE "[ ]*\n" "; " CXX_VERSION_RESULT "${CXX_VERSION_RESULT}")
|
||||
message(STATUS "Compiler: ${CXX_VERSION_RESULT}")
|
||||
message(STATUS "Compiler: ${CXX_VERSION_RESULT}, ${CMAKE_CXX_COMPILE_FEATURES}")
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include <nlohmann/detail/meta/type_traits.hpp>
|
||||
#include <nlohmann/detail/value_t.hpp>
|
||||
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
#ifdef JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#if JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#include <experimental/filesystem>
|
||||
namespace nlohmann::detail
|
||||
@ -460,7 +460,7 @@ void from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyE
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
#ifdef JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
template<typename BasicJsonType>
|
||||
void from_json(const BasicJsonType& j, std_fs::path& p)
|
||||
{
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#include <nlohmann/detail/meta/type_traits.hpp>
|
||||
#include <nlohmann/detail/value_t.hpp>
|
||||
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
#ifdef JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#if JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#include <experimental/filesystem>
|
||||
namespace nlohmann::detail
|
||||
@ -403,7 +403,7 @@ void to_json(BasicJsonType& j, const T& t)
|
||||
to_json_tuple_impl(j, t, make_index_sequence<std::tuple_size<T>::value> {});
|
||||
}
|
||||
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
#ifdef JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
template<typename BasicJsonType>
|
||||
void to_json(BasicJsonType& j, const std_fs::path& p)
|
||||
{
|
||||
|
||||
@ -52,6 +52,11 @@
|
||||
#else
|
||||
#define JSON_STD_FILESYSTEM_EXPERIMENTAL 0
|
||||
#endif
|
||||
|
||||
// std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/
|
||||
#if __MINGW32__ && __GNUC__ == 8
|
||||
#undef JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// disable documentation warnings on clang
|
||||
|
||||
@ -2340,6 +2340,11 @@ using is_detected_convertible =
|
||||
#else
|
||||
#define JSON_STD_FILESYSTEM_EXPERIMENTAL 0
|
||||
#endif
|
||||
|
||||
// std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/
|
||||
#if __MINGW32__ && __GNUC__ == 8
|
||||
#undef JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// disable documentation warnings on clang
|
||||
@ -3967,7 +3972,7 @@ T conditional_static_cast(U value)
|
||||
// #include <nlohmann/detail/value_t.hpp>
|
||||
|
||||
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
#ifdef JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#if JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#include <experimental/filesystem>
|
||||
namespace nlohmann::detail
|
||||
@ -4408,7 +4413,7 @@ void from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyE
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
#ifdef JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
template<typename BasicJsonType>
|
||||
void from_json(const BasicJsonType& j, std_fs::path& p)
|
||||
{
|
||||
@ -4655,7 +4660,7 @@ class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >>
|
||||
// #include <nlohmann/detail/value_t.hpp>
|
||||
|
||||
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
#ifdef JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#if JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#include <experimental/filesystem>
|
||||
namespace nlohmann::detail
|
||||
@ -5043,7 +5048,7 @@ void to_json(BasicJsonType& j, const T& t)
|
||||
to_json_tuple_impl(j, t, make_index_sequence<std::tuple_size<T>::value> {});
|
||||
}
|
||||
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
#ifdef JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
template<typename BasicJsonType>
|
||||
void to_json(BasicJsonType& j, const std_fs::path& p)
|
||||
{
|
||||
|
||||
@ -62,6 +62,11 @@ using ordered_json = nlohmann::ordered_json;
|
||||
#define JSON_STD_FILESYSTEM_EXPERIMENTAL 1
|
||||
#else
|
||||
#define JSON_STD_FILESYSTEM_EXPERIMENTAL 0
|
||||
|
||||
// std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/
|
||||
#if __MINGW32__ && __GNUC__ == 8
|
||||
#undef JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
@ -379,9 +384,7 @@ TEST_CASE("regression tests 2")
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
SECTION("issue #1292 - Serializing std::variant causes stack overflow")
|
||||
{
|
||||
static_assert(
|
||||
!std::is_constructible<json, std::variant<int, float>>::value,
|
||||
"");
|
||||
static_assert(!std::is_constructible<json, std::variant<int, float>>::value, "unexpected value");
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -756,7 +759,7 @@ TEST_CASE("regression tests 2")
|
||||
CHECK(j == k);
|
||||
}
|
||||
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
#ifdef JSON_STD_FILESYSTEM_EXPERIMENTAL
|
||||
SECTION("issue #3070 - Version 3.10.3 breaks backward-compatibility with 3.10.2 ")
|
||||
{
|
||||
nlohmann::detail::std_fs::path text_path("/tmp/text.txt");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user