doc: updated doc for any/meta_any

This commit is contained in:
Michele Caini
2021-05-02 00:17:08 +02:00
parent 2b5c393a13
commit eca7484e30
2 changed files with 6 additions and 4 deletions

View File

@@ -282,6 +282,7 @@ int value = 42;
entt::any any{std::in_place_type<int &>(value)};
entt::any cany = entt::make_any<const int &>(value);
entt::any fwd = entt::forward_as_any(value);
any.emplace<const int &>(value);
```

View File

@@ -210,9 +210,10 @@ Among the few relevant differences, `meta_any` adds support for containers and
pointer-like types (see the following sections for more details), while `any`
does not.<br/>
Similar to `any`, this class can also be used to create _aliases_ for unmanaged
objects either upon construction using `std::in_place_type<T &>` or from an
existing instance by means of the `as_ref` function. However, unlike `any`,
`meta_any` treats an empty instance and one initialized with `void` differently:
objects either with `forward_as_meta` or using the `std::in_place_type<T &>`
disambiguation tag, as well as from an existing object by means of the `as_ref`
member function. However, unlike `any`, `meta_any` treats an empty instance and
one initialized with `void` differently:
```cpp
entt::meta_any empty{};
@@ -386,7 +387,7 @@ object for a sequence container:
```cpp
std::vector<int> vec{1, 2, 3};
entt::meta_any any = std::make_meta_any<std::vector<int> &>(vec);
entt::meta_any any = entt::forward_as_meta(vec);
if(any.type().is_sequence_container()) {
if(auto view = any.as_sequence_container(); view) {