diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp index 1fcc587a4..355cf9acf 100644 --- a/include/nlohmann/detail/conversions/from_json.hpp +++ b/include/nlohmann/detail/conversions/from_json.hpp @@ -24,28 +24,11 @@ #include #include #include +#include #include #include #include -#if JSON_HAS_EXPERIMENTAL_FILESYSTEM -#include -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ -namespace std_fs = std::experimental::filesystem; -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END -#elif JSON_HAS_FILESYSTEM -#include -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ -namespace std_fs = std::filesystem; -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END -#endif - NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index 3cb6b6a70..bd70bfaff 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -20,27 +20,10 @@ #include #include #include +#include #include #include -#if JSON_HAS_EXPERIMENTAL_FILESYSTEM -#include -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ -namespace std_fs = std::experimental::filesystem; -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END -#elif JSON_HAS_FILESYSTEM -#include -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ -namespace std_fs = std::filesystem; -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END -#endif - NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { diff --git a/include/nlohmann/detail/meta/std_fs.hpp b/include/nlohmann/detail/meta/std_fs.hpp new file mode 100644 index 000000000..edf7bdaff --- /dev/null +++ b/include/nlohmann/detail/meta/std_fs.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include + +#if JSON_HAS_EXPERIMENTAL_FILESYSTEM +#include +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ +namespace std_fs = std::experimental::filesystem; +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END +#elif JSON_HAS_FILESYSTEM +#include +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ +namespace std_fs = std::filesystem; +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END +#endif diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 6d91780a5..ce4ce3bb4 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -4449,11 +4449,10 @@ template struct identity_tag {}; } // namespace detail NLOHMANN_JSON_NAMESPACE_END -// #include +// #include -// #include -// #include +// #include #if JSON_HAS_EXPERIMENTAL_FILESYSTEM @@ -4474,6 +4473,13 @@ namespace std_fs = std::filesystem; NLOHMANN_JSON_NAMESPACE_END #endif +// #include + +// #include + +// #include + + NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { @@ -5212,29 +5218,13 @@ class tuple_element> // #include +// #include + // #include // #include -#if JSON_HAS_EXPERIMENTAL_FILESYSTEM -#include -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ -namespace std_fs = std::experimental::filesystem; -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END -#elif JSON_HAS_FILESYSTEM -#include -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ -namespace std_fs = std::filesystem; -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END -#endif - NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail {