|
| template<typename T, typename Make> |
| Base & | ensure (Make &&make) |
| | The slot for T, created by make the first time it is asked for.
|
| template<typename T> |
| Base * | find () |
| | The slot for T without creating one.
|
| template<typename T> |
| const Base * | find () const |
| | The slot for T without creating one.
|
| template<typename T> |
| std::unique_ptr< Base > & | slot () |
| | The owning pointer for T's slot, grown into existence but left empty.
|
|
void | clear () |
| | Drop every slot. Types are re-registered lazily on the next ask.
|
| template<typename Pred> |
| void | removeIf (Pred &&pred) |
| | Empty every slot pred accepts, keeping the rest where they are.
|
| void | swap (TypeRegistry &other) noexcept |
| | Exchange every slot with another registry.
|
| std::size_t | count () const |
| | How many types actually have a slot.
|
| template<typename Fn> |
| void | forEach (Fn &&fn) |
| | Invoke fn(Base&) for every filled slot, in type-id order.
|
| template<typename Fn> |
| void | forEach (Fn &&fn) const |
| | Invoke fn(Base&) for every filled slot, in type-id order.
|
template<typename Base>
class Vkm::Engine::TypeRegistry< Base >
One slot per type, indexed by typeId<T>() and filled on first use.
Type ids are shared across registries, so slots for other registries' types sit empty.
- Template Parameters
-
| Base | What every slot holds: a polymorphic base or a per-type struct. |