{"action":"created","issue":{"url":"https://api.github.com/repos/kimwalisch/primesieve/issues/65","repository_url":"https://api.github.com/repos/kimwalisch/primesieve","labels_url":"https://api.github.com/repos/kimwalisch/primesieve/issues/65/labels{/name}","comments_url":"https://api.github.com/repos/kimwalisch/primesieve/issues/65/comments","events_url":"https://api.github.com/repos/kimwalisch/primesieve/issues/65/events","html_url":"https://github.com/kimwalisch/primesieve/issues/65","id":386517274,"node_id":"MDU6SXNzdWUzODY1MTcyNzQ=","number":65,"title":"Feature request:  iterator move-constructor and move-assignment","user":{"login":"cgd8d","id":1078973,"node_id":"MDQ6VXNlcjEwNzg5NzM=","avatar_url":"https://avatars0.githubusercontent.com/u/1078973?v=4","gravatar_id":"","url":"https://api.github.com/users/cgd8d","html_url":"https://github.com/cgd8d","followers_url":"https://api.github.com/users/cgd8d/followers","following_url":"https://api.github.com/users/cgd8d/following{/other_user}","gists_url":"https://api.github.com/users/cgd8d/gists{/gist_id}","starred_url":"https://api.github.com/users/cgd8d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgd8d/subscriptions","organizations_url":"https://api.github.com/users/cgd8d/orgs","repos_url":"https://api.github.com/users/cgd8d/repos","events_url":"https://api.github.com/users/cgd8d/events{/privacy}","received_events_url":"https://api.github.com/users/cgd8d/received_events","type":"User","site_admin":false},"labels":[{"id":57864364,"node_id":"MDU6TGFiZWw1Nzg2NDM2NA==","url":"https://api.github.com/repos/kimwalisch/primesieve/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":{"login":"kimwalisch","id":4656219,"node_id":"MDQ6VXNlcjQ2NTYyMTk=","avatar_url":"https://avatars3.githubusercontent.com/u/4656219?v=4","gravatar_id":"","url":"https://api.github.com/users/kimwalisch","html_url":"https://github.com/kimwalisch","followers_url":"https://api.github.com/users/kimwalisch/followers","following_url":"https://api.github.com/users/kimwalisch/following{/other_user}","gists_url":"https://api.github.com/users/kimwalisch/gists{/gist_id}","starred_url":"https://api.github.com/users/kimwalisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimwalisch/subscriptions","organizations_url":"https://api.github.com/users/kimwalisch/orgs","repos_url":"https://api.github.com/users/kimwalisch/repos","events_url":"https://api.github.com/users/kimwalisch/events{/privacy}","received_events_url":"https://api.github.com/users/kimwalisch/received_events","type":"User","site_admin":false},"assignees":[{"login":"kimwalisch","id":4656219,"node_id":"MDQ6VXNlcjQ2NTYyMTk=","avatar_url":"https://avatars3.githubusercontent.com/u/4656219?v=4","gravatar_id":"","url":"https://api.github.com/users/kimwalisch","html_url":"https://github.com/kimwalisch","followers_url":"https://api.github.com/users/kimwalisch/followers","following_url":"https://api.github.com/users/kimwalisch/following{/other_user}","gists_url":"https://api.github.com/users/kimwalisch/gists{/gist_id}","starred_url":"https://api.github.com/users/kimwalisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimwalisch/subscriptions","organizations_url":"https://api.github.com/users/kimwalisch/orgs","repos_url":"https://api.github.com/users/kimwalisch/repos","events_url":"https://api.github.com/users/kimwalisch/events{/privacy}","received_events_url":"https://api.github.com/users/kimwalisch/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2018-12-02T01:52:33Z","updated_at":"2018-12-02T14:07:34Z","closed_at":null,"author_association":"NONE","body":"The following silly code currently fails to compile:\r\n\r\n    #include \"primesieve.hpp\"\r\n    \r\n    int main()\r\n    {\r\n      std::vector<primesieve::iterator> vec;\r\n      vec.emplace_back(0, 1000); // Requires move-constructor\r\n      primesieve::iterator it2, it3;\r\n      it2 = std::move(it3); // Requires move-assignment\r\n    }\r\n\r\nThis can be fixed by declaring a default move-constructor and move-assignment operator.  Code could be as follows.\r\n\r\nIn iterator.hpp:\r\n\r\n    iterator(iterator&&);\r\n    iterator& operator=(iterator&&);\r\n\r\nIn iterator.cpp:\r\n\r\n    iterator::iterator(iterator&&) = default;\r\n    iterator& iterator::operator=(iterator&&) = default;\r\n\r\nAlthough the example is purely silly, I think it would do no harm to provide these functions, and would support some convenient manipulations of iterators.  For myself, storing a small collection of iterators in a std::vector would be convenient."},"comment":{"url":"https://api.github.com/repos/kimwalisch/primesieve/issues/comments/443510255","html_url":"https://github.com/kimwalisch/primesieve/issues/65#issuecomment-443510255","issue_url":"https://api.github.com/repos/kimwalisch/primesieve/issues/65","id":443510255,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzUxMDI1NQ==","user":{"login":"kimwalisch","id":4656219,"node_id":"MDQ6VXNlcjQ2NTYyMTk=","avatar_url":"https://avatars3.githubusercontent.com/u/4656219?v=4","gravatar_id":"","url":"https://api.github.com/users/kimwalisch","html_url":"https://github.com/kimwalisch","followers_url":"https://api.github.com/users/kimwalisch/followers","following_url":"https://api.github.com/users/kimwalisch/following{/other_user}","gists_url":"https://api.github.com/users/kimwalisch/gists{/gist_id}","starred_url":"https://api.github.com/users/kimwalisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimwalisch/subscriptions","organizations_url":"https://api.github.com/users/kimwalisch/orgs","repos_url":"https://api.github.com/users/kimwalisch/repos","events_url":"https://api.github.com/users/kimwalisch/events{/privacy}","received_events_url":"https://api.github.com/users/kimwalisch/received_events","type":"User","site_admin":false},"created_at":"2018-12-02T14:07:34Z","updated_at":"2018-12-02T14:07:34Z","author_association":"OWNER","body":"Apparently it is good practice to declare the move-constructor and move-assignment operators as ```noexcept``` . Most C++ objects in the STL also do this e.g. [unique_ptr](https://en.cppreference.com/w/cpp/memory/unique_ptr/operator%3D).\r\n\r\n```C++\r\n// iterator.hpp:\r\niterator(iterator&&) noexcept;\r\niterator& operator=(iterator&&) noexcept;\r\n```\r\n\r\n```C++\r\n// iterator.cpp:\r\niterator::iterator(iterator&&) noexcept = default;\r\niterator& iterator::operator=(iterator&&) noexcept = default;\r\n```\r\n\r\nSee this [blog post](https://akrzemi1.wordpress.com/2015/09/11/declaring-the-move-constructor/) for in depth explanation."}}
{"actor":{"display_login":"kimwalisch"}}