json/doc/mkdocs/docs/api/macros/json_has_filesystem.md
Niels Lohmann a6ee8bf9d9
Overwork documentation (#3444)
* 📝 overwork macro documentation

* 📝 address review comments

* 🔧 add style check to Makefile

* 🙈 overwork .gitignore

* 📌 Pygments 2.12.0 is broken

* ✏️ fix links

* 🚸 adjust output to cppcheck

* 📝 add titles to more admonitions

* ✏️ fix typos

* 📝 document future behavior change
2022-04-25 22:40:45 +02:00

1.3 KiB

JSON_HAS_FILESYSTEM / JSON_HAS_EXPERIMENTAL_FILESYSTEM

#define JSON_HAS_FILESYSTEM /* value */
#define JSON_HAS_EXPERIMENTAL_FILESYSTEM /* value */

When compiling with C++17, the library provides conversions from and to std::filesystem::path. As compiler support for filesystem is limited, the library tries to detect whether <filesystem>/std::filesystem (JSON_HAS_FILESYSTEM) or <experimental/filesystem>/std::experimental::filesystem (JSON_HAS_EXPERIMENTAL_FILESYSTEM) should be used. To override the built-in check, define JSON_HAS_FILESYSTEM or JSON_HAS_EXPERIMENTAL_FILESYSTEM to 1.

Default definition

The default value is detected based on the preprocessor macros #!cpp __cpp_lib_filesystem, #!cpp __cpp_lib_experimental_filesystem, #!cpp __has_include(<filesystem>), or #!cpp __has_include(<experimental/filesystem>).

Notes

  • Note that older compilers or older versions of libstd++ also require the library stdc++fs to be linked to for filesystem support.
  • Both macros are undefined outside the library.

Version history

  • Added in version 3.10.5.