Add proper C++20 module support (#4799)

This commit is contained in:
Miko authored and GitHub committed 2025-06-29 22:02:31 +02:00
1 parent d70e46bc65
commit b7f741165b
10 files changed
+123 -24

No files matched your search

+13
View File
@@ -158,6 +158,19 @@ std::ifstream f("example.json");
json data = json::parse(f);
```
If using modules (enabled with `NLOHMANN_JSON_BUILD_MODULES`), this example becomes:
```cpp
import std;
import nlohmann.json;
using json = nlohmann::json;
// ...
std::ifstream f("example.json");
json data = json::parse(f);
```
### Creating `json` objects from JSON literals
Assume you want to create hard-code this literal JSON value in a file, as a `json` object: