{"action":"created","issue":{"url":"https://api.github.com/repos/skypjack/entt/issues/54","repository_url":"https://api.github.com/repos/skypjack/entt","labels_url":"https://api.github.com/repos/skypjack/entt/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/skypjack/entt/issues/54/comments","events_url":"https://api.github.com/repos/skypjack/entt/issues/54/events","html_url":"https://github.com/skypjack/entt/issues/54","id":302897322,"number":54,"title":"Call for comments: spaces","user":{"login":"skypjack","id":1812216,"avatar_url":"https://avatars1.githubusercontent.com/u/1812216?v=4","gravatar_id":"","url":"https://api.github.com/users/skypjack","html_url":"https://github.com/skypjack","followers_url":"https://api.github.com/users/skypjack/followers","following_url":"https://api.github.com/users/skypjack/following{/other_user}","gists_url":"https://api.github.com/users/skypjack/gists{/gist_id}","starred_url":"https://api.github.com/users/skypjack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skypjack/subscriptions","organizations_url":"https://api.github.com/users/skypjack/orgs","repos_url":"https://api.github.com/users/skypjack/repos","events_url":"https://api.github.com/users/skypjack/events{/privacy}","received_events_url":"https://api.github.com/users/skypjack/received_events","type":"User","site_admin":false},"labels":[{"id":698692802,"url":"https://api.github.com/repos/skypjack/entt/labels/discussion","name":"discussion","color":"fbca04","default":false},{"id":570245205,"url":"https://api.github.com/repos/skypjack/entt/labels/help%20wanted","name":"help wanted","color":"128A0C","default":true}],"state":"closed","locked":false,"assignee":{"login":"skypjack","id":1812216,"avatar_url":"https://avatars1.githubusercontent.com/u/1812216?v=4","gravatar_id":"","url":"https://api.github.com/users/skypjack","html_url":"https://github.com/skypjack","followers_url":"https://api.github.com/users/skypjack/followers","following_url":"https://api.github.com/users/skypjack/following{/other_user}","gists_url":"https://api.github.com/users/skypjack/gists{/gist_id}","starred_url":"https://api.github.com/users/skypjack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skypjack/subscriptions","organizations_url":"https://api.github.com/users/skypjack/orgs","repos_url":"https://api.github.com/users/skypjack/repos","events_url":"https://api.github.com/users/skypjack/events{/privacy}","received_events_url":"https://api.github.com/users/skypjack/received_events","type":"User","site_admin":false},"assignees":[{"login":"skypjack","id":1812216,"avatar_url":"https://avatars1.githubusercontent.com/u/1812216?v=4","gravatar_id":"","url":"https://api.github.com/users/skypjack","html_url":"https://github.com/skypjack","followers_url":"https://api.github.com/users/skypjack/followers","following_url":"https://api.github.com/users/skypjack/following{/other_user}","gists_url":"https://api.github.com/users/skypjack/gists{/gist_id}","starred_url":"https://api.github.com/users/skypjack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skypjack/subscriptions","organizations_url":"https://api.github.com/users/skypjack/orgs","repos_url":"https://api.github.com/users/skypjack/repos","events_url":"https://api.github.com/users/skypjack/events{/privacy}","received_events_url":"https://api.github.com/users/skypjack/received_events","type":"User","site_admin":false}],"milestone":null,"comments":20,"created_at":"2018-03-06T22:46:08Z","updated_at":"2018-03-15T12:27:31Z","closed_at":"2018-03-11T22:15:25Z","author_association":"OWNER","body":"I've been fascinated for a while by the [idea of having spaces](https://gamedevelopment.tutsplus.com/tutorials/spaces-useful-game-object-containers--gamedev-14091) implemented directly within `EnTT`.  \r\nActually, more than once I found myself saying - _uff, if only I had spaces here, it would be easier to do this_.  \r\n\r\nHowever I postponed the implementation because:\r\n* I didn't want them to be part of the registry, because not all users want them and find them useful - in other terms, I don't want to introduce spaces and thus to affect performance of the registry in any case.\r\n* I didn't want them to not be part of the registry, because I wasn't able to find a way to _make it work_ properly (mainly to keep spaces in sync with a registry isn't for free).\r\n\r\nFinally, perhaps I found a way to implement spaces and give them a minimal API that _just works_.  \r\nThe goal is to not add a duplicated set of functions from the registry, only to add boilerplate all around the codebase.\r\n\r\nNot exactly the same, but here is an example of what it will look like probably:\r\n```\r\ntemplate<typename Entity>\r\nstruct Space {\r\n   Space(Registry<Entity> &registry);\r\n\r\n    // iterate all the entities, false positive (invalid entities) are possible\r\n    iterator_type begin() const noexcept;\r\n    iterator_type end() const noexcept;\r\n\r\n    // create an entity and assign it directly to the space\r\n    entity_type create();\r\n\r\n    // assign an entitiy to the registry\r\n    void assign(entity_type entity);\r\n\r\n    // iterate entities using a standard view internally, invoke the function for each entity\r\n    // invalid entities are filtered out an never returned through func (lazy clean of a space)\r\n    template<typename... Component, typename Func>\r\n    void view(Func func);\r\n\r\n    // iterate entities using a persistent view internally, invoke the function for each entity\r\n    // invalid entities are filtered out an never returned through func (lazy clean of a space)\r\n    template<typename... Component, typename Func>\r\n    void persistent(Func func);\r\n\r\n    operator const registry_type & () const noexcept;\r\n    operator registry_type & () noexcept;\r\n};\r\n```\r\nMinimal, clean, does the job. Users cannot do _everything_ with the sole space, they must work together with the registry. On the other side, spaces won't affect the performance of a registry in case one doesn't use them.  \r\nMoreover, spaces won't have dedicated views. They offer only two `each`-like functions under the names `view` and `persistent`.  \nFinally, users can create how many spaces they want at runtime this way. They don't have a name or  an identity. Consider a space as a partition of a registry.\r\n\r\n---\r\n\r\nAny feedback or suggestion is really appreciated. Questions are good as well.  \r\nI still have some doubts, but I prefer not to influence you.  :-)"},"comment":{"url":"https://api.github.com/repos/skypjack/entt/issues/comments/373359045","html_url":"https://github.com/skypjack/entt/issues/54#issuecomment-373359045","issue_url":"https://api.github.com/repos/skypjack/entt/issues/54","id":373359045,"user":{"login":"UnoYakshi","id":5715383,"avatar_url":"https://avatars3.githubusercontent.com/u/5715383?v=4","gravatar_id":"","url":"https://api.github.com/users/UnoYakshi","html_url":"https://github.com/UnoYakshi","followers_url":"https://api.github.com/users/UnoYakshi/followers","following_url":"https://api.github.com/users/UnoYakshi/following{/other_user}","gists_url":"https://api.github.com/users/UnoYakshi/gists{/gist_id}","starred_url":"https://api.github.com/users/UnoYakshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UnoYakshi/subscriptions","organizations_url":"https://api.github.com/users/UnoYakshi/orgs","repos_url":"https://api.github.com/users/UnoYakshi/repos","events_url":"https://api.github.com/users/UnoYakshi/events{/privacy}","received_events_url":"https://api.github.com/users/UnoYakshi/received_events","type":"User","site_admin":false},"created_at":"2018-03-15T12:27:31Z","updated_at":"2018-03-15T12:27:31Z","author_association":"NONE","body":"Maybe, it's too late, but Spaces sounds like something like a complicated version of **tagging**.\r\nPseudo-code:\r\n\r\n    object_1->tags = [\"ai\"];\r\n    object_2->tags = [\"vfx\", \"art\"];\r\n    object_3->tags = [\"physics\", \"art\"];\r\n    \r\n    auto spaceslike_object = find_by_tags([\"vfx\", \"ai\"]);  // Returns the first two objects...`"}}
{"actor":{"display_login":"UnoYakshi"}}