// (1) basic_json_document() = default; // (2) basic_json_document(basic_json_document&& other) noexcept = default; // (3) basic_json_document(const basic_json_document&) = delete;
root() returns a discarded view, and is_discarded() is #!cpp true.other's index and, if owned, its text; other is left as an empty document. Views taken from other before the move remain valid, because the index is heap-allocated independently of the basic_json_document object.basic_json_document is move-only. Copying is disabled because of its cost: a copy would duplicate the whole index, the decoded-string buffer, and the owned text, while a move is enough in every use we know of.other (in) : another document to move the index and text from
No-throw guarantee: the default and move constructors never throw exceptions.
Constant.
??? example
The example below shows the default constructor and demonstrates that `basic_json_document` is move-only.
```cpp
#include <iostream>
#include <utility>
#include <nlohmann/json_view.hpp>
using json_document = nlohmann::json_document;
int main()
{
std::cout << std::boolalpha;
// the default constructor creates an empty (discarded) document
json_document empty;
std::cout << empty.is_discarded() << '\n';
// json_document is move-only: parse() itself returns by value (moved out),
// and a document can be moved again, e.g. into a container
json_document doc = json_document::parse(R"({"a": 1})");
json_document moved = std::move(doc);
std::cout << moved.root().is_object() << '\n';
// copying is disabled at compile time:
// json_document another = moved; // does not compile
}
```
Output:
```json
true
true
```