Document how user-defined views are treated when converting an rvalue

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-11-17 17:04:18 +01:00
1 parent 4503e5d9bc
commit 5eed8c5433
1 file changed
+2
@@ -83,6 +83,8 @@ basic_json(basic_json&& other) noexcept;
elements are moved from, that is, containers whose elements are `const` when accessed through a `const`
container. Non-owning ranges such as spans or iterator ranges (e.g., `gsl::span`, `std::span`) are copied, so
converting an rvalue span leaves the referenced elements unchanged.
A user-defined view whose elements are `const` through a `const` view, but which does not own them, is
treated as owning; pass such a view as an lvalue to copy the elements.
- **numbers**: [`number_integer_t`](number_integer_t.md), [`number_unsigned_t`](number_unsigned_t.md),
[`number_float_t`](number_float_t.md), and all convertible number types such as `int`, `size_t`, `int64_t`, `float`
or `double` can be used.