Document that shared-storage handles are moved from as owning containers
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 file changed
+4
-2
@@ -83,8 +83,10 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
elements are moved from, that is, containers whose elements are `const` when accessed through a `const`
|
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
|
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.
|
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
|
A user-defined type whose elements are `const` through a `const` object, but which does not own them alone,
|
||||||
treated as owning; pass such a view as an lvalue to copy the elements.
|
is treated as owning: a view, or a handle that shares its storage with other handles (e.g., a wrapper of a
|
||||||
|
`std::shared_ptr<std::vector<T>>`) and does not copy it before giving non-`const` access. Moving from such
|
||||||
|
an rvalue changes the elements seen through the other handles; pass it as an lvalue to copy the elements.
|
||||||
- **numbers**: [`number_integer_t`](number_integer_t.md), [`number_unsigned_t`](number_unsigned_t.md),
|
- **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`
|
[`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.
|
or `double` can be used.
|
||||||
|
|||||||
Reference in new issue
Block a user