Skip to content

Commit

Permalink
meta system:
Browse files Browse the repository at this point in the history
* perf improvements
* meta_any::try_cast
* meta_any is void-friendly
* meta_any support for unmanaged objects
* general cleanup
  • Loading branch information
skypjack committed Jul 28, 2019
1 parent 7116df1 commit bad97a8
Show file tree
Hide file tree
Showing 5 changed files with 640 additions and 593 deletions.
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* multi component registry::remove and some others?
* can I use opaque connection also for the emitter?
* built-in support for dual (or N-) buffering
* meta: opaque references and pointers

TODO
* custom (decoupled) pools ==> double buffering, shared components, multi-model
* use direct access (pool-like) also for context variables
20 changes: 14 additions & 6 deletions docs/md/meta.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,21 @@ entt::meta_any any{0};
entt::meta_any empty{};
```
It can be constructed or assigned by copy and move and it takes the burden of
destroying the contained object when required.<br/>
It takes the burden of destroying the contained instance when required.<br/>
Moreover, it can be used as an opaque container for unmanaged objects if needed:
```cpp
int value;
entt::meta_any any{std::in_place, value};
```

In this case, the contained instance is never destroyed and users must ensure
that the lifetime of the object exceeds that of the container.

A meta any object has a `type` member function that returns the meta type of the
contained value, if any. The member functions `can_cast` and `can_convert` are
used to know if the underlying object has a given type as a base or if it can be
converted implicitly to it. Similarly, `cast` and `convert` do what they promise
and return the expected value.
contained value, if any. The member functions `try_cast`, `cast` and `convert`
are used to know if the underlying object has a given type as a base or if it
can be converted implicitly to it.

## Enjoy the runtime

Expand Down
Loading

0 comments on commit bad97a8

Please sign in to comment.