{"action":"created","issue":{"url":"https://api.github.com/repos/alecthomas/entityx/issues/164","repository_url":"https://api.github.com/repos/alecthomas/entityx","labels_url":"https://api.github.com/repos/alecthomas/entityx/issues/164/labels{/name}","comments_url":"https://api.github.com/repos/alecthomas/entityx/issues/164/comments","events_url":"https://api.github.com/repos/alecthomas/entityx/issues/164/events","html_url":"https://github.com/alecthomas/entityx/issues/164","id":196139577,"number":164,"title":"Feature request for: entities.entities_with_components( c ).size()","user":{"login":"visorz","id":1767472,"avatar_url":"https://avatars.githubusercontent.com/u/1767472?v=3","gravatar_id":"","url":"https://api.github.com/users/visorz","html_url":"https://github.com/visorz","followers_url":"https://api.github.com/users/visorz/followers","following_url":"https://api.github.com/users/visorz/following{/other_user}","gists_url":"https://api.github.com/users/visorz/gists{/gist_id}","starred_url":"https://api.github.com/users/visorz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/visorz/subscriptions","organizations_url":"https://api.github.com/users/visorz/orgs","repos_url":"https://api.github.com/users/visorz/repos","events_url":"https://api.github.com/users/visorz/events{/privacy}","received_events_url":"https://api.github.com/users/visorz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-16T19:45:39Z","updated_at":"2016-12-17T00:41:31Z","closed_at":"2016-12-17T00:41:31Z","body":"Thank you a lot for your clear and clean library. I am using it for my computer graphics lab program and it is the best solution for a clean and easy to read program architecture.\r\n\r\nI would like to count entities and instead of writing:\r\n\r\n    entityx::ComponentHandle<Position> pos;\r\n    auto begin = entities.entities_with_components( pos ).begin();\r\n    auto end = entities.entities_with_components( pos ).end();\r\n    const auto modelCount = std::distance( begin, end );\r\n\r\nI would like to use a shorter form:\r\n\r\n    entityx::ComponentHandle<Position> pos;\r\n    const auto modelCount = entities.entities_with_components( pos ).size();\r\n\r\nAnd because internally components are vectors, I guess you could realise this in an easy way."},"comment":{"url":"https://api.github.com/repos/alecthomas/entityx/issues/comments/267729626","html_url":"https://github.com/alecthomas/entityx/issues/164#issuecomment-267729626","issue_url":"https://api.github.com/repos/alecthomas/entityx/issues/164","id":267729626,"user":{"login":"alecthomas","id":41767,"avatar_url":"https://avatars.githubusercontent.com/u/41767?v=3","gravatar_id":"","url":"https://api.github.com/users/alecthomas","html_url":"https://github.com/alecthomas","followers_url":"https://api.github.com/users/alecthomas/followers","following_url":"https://api.github.com/users/alecthomas/following{/other_user}","gists_url":"https://api.github.com/users/alecthomas/gists{/gist_id}","starred_url":"https://api.github.com/users/alecthomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alecthomas/subscriptions","organizations_url":"https://api.github.com/users/alecthomas/orgs","repos_url":"https://api.github.com/users/alecthomas/repos","events_url":"https://api.github.com/users/alecthomas/events{/privacy}","received_events_url":"https://api.github.com/users/alecthomas/received_events","type":"User","site_admin":false},"created_at":"2016-12-17T00:41:31Z","updated_at":"2016-12-17T00:41:31Z","body":"You should use [std::distance](http://www.cplusplus.com/reference/iterator/distance/). A size() method would be basically doing the same thing as the component vectors can have holes."}}
{"actor":{"display_login":"alecthomas"}}