Files
json/examples/basic_json_view__basic_json_view.cpp
T
2026-10-21 10:31:00 +00:00

18 lines
497 B
C++

#include <iostream>
#include <nlohmann/json_view.hpp>
int main()
{
std::cout << std::boolalpha;
// the default constructor is the only public one: it creates an invalid
// (discarded) view, useful as a "no value yet" placeholder
nlohmann::json_view v;
std::cout << v.is_discarded() << '\n';
// views are trivially copyable handles (two pointers); the document owns
// the actual data
nlohmann::json_view copy = v;
std::cout << copy.is_discarded() << '\n';
}