Skip to content

registry.view<> on subset of entities without using Tags #1137

Answered by skypjack
ostorek asked this question in Q&A
Discussion options

You must be logged in to vote

Can i somehow create temporary storage, fill it with children entities and create on it view that would do the trick and then return them both?

Yeah, definitely. You can create the storage as a standlone member of your class or within the registry with its own name:

struct foo {
    // as member
    entt::storage_type_t<void> storage{};
};

// as managed by the registry
auto &storage = registry.storage<void>("my_name"_hs);

Consider that in the first case you have to manually cleanup it while ie destroy would work on the storage managed by the registry too.
Anyway, when you have it, you can slap it into a view and combine the latter with a second view as you like. For example:

for(auto […

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@ostorek
Comment options

@skypjack
Comment options

Answer selected by ostorek
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
discussion it sounds interesting, let's discuss it
3 participants