mirror of
https://github.com/nlohmann/json.git
synced 2026-09-30 14:05:18 +00:00
Export json_document and json_view from the C++20 module
The nlohmann.json module includes json_view.hpp in its global module fragment and exports basic_json_document, basic_json_view, and the four aliases next to basic_json, json, and ordered_json. features/modules.md lists them, and tests/module_cpp20 parses a document, so that a missing export fails the ci_module_cpp20 job. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -52,8 +52,13 @@ int main()
|
||||
std::ostringstream os;
|
||||
os << j << oj << lit;
|
||||
|
||||
// json_document / json_view (json_view.hpp): zero-copy parse of a literal
|
||||
const nlohmann::json_document doc = nlohmann::json_document::parse(R"({"a": 1, "list": [1, 2, 3]})");
|
||||
const std::size_t doc_size = doc.root().size();
|
||||
|
||||
// use every result so the references cannot be optimized away
|
||||
return (a == 1 && last == 3 && b == 2 && lit.size() == 3
|
||||
&& m.size() == 1 && !dumped.empty() && !os.str().empty())
|
||||
&& m.size() == 1 && !dumped.empty() && !os.str().empty()
|
||||
&& doc_size == 2)
|
||||
? 0 : 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user