mirror of
https://github.com/nlohmann/json.git
synced 2026-10-22 05:58:12 +00:00
18 lines
497 B
C++
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';
|
|
}
|