{"action":"created","issue":{"url":"https://api.github.com/repos/kylelutz/compute/issues/452","labels_url":"https://api.github.com/repos/kylelutz/compute/issues/452/labels{/name}","comments_url":"https://api.github.com/repos/kylelutz/compute/issues/452/comments","events_url":"https://api.github.com/repos/kylelutz/compute/issues/452/events","html_url":"https://github.com/kylelutz/compute/pull/452","id":67951873,"number":452,"title":"Add strided_iterator class (skip_iterator) #121","user":{"login":"haahh","id":2720260,"avatar_url":"https://avatars.githubusercontent.com/u/2720260?v=3","gravatar_id":"","url":"https://api.github.com/users/haahh","html_url":"https://github.com/haahh","followers_url":"https://api.github.com/users/haahh/followers","following_url":"https://api.github.com/users/haahh/following{/other_user}","gists_url":"https://api.github.com/users/haahh/gists{/gist_id}","starred_url":"https://api.github.com/users/haahh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haahh/subscriptions","organizations_url":"https://api.github.com/users/haahh/orgs","repos_url":"https://api.github.com/users/haahh/repos","events_url":"https://api.github.com/users/haahh/events{/privacy}","received_events_url":"https://api.github.com/users/haahh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-12T20:07:44Z","updated_at":"2015-04-15T18:11:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kylelutz/compute/pulls/452","html_url":"https://github.com/kylelutz/compute/pull/452","diff_url":"https://github.com/kylelutz/compute/pull/452.diff","patch_url":"https://github.com/kylelutz/compute/pull/452.patch"},"body":"This addresses issue #121.\r\n\r\nI've added ```strided_iterator``` adaptor which - as requested - skips over multiple elements each time it is incremented. It's called strided_iterator to match corresponding iterator in the Boost.Range library (see [boost/range/adaptor/strided.hpp](http://www.boost.org/doc/libs/1_58_0/boost/range/adaptor/strided.hpp)). Tests included. \r\n\r\nI've also included function ```make_strided_iterator_end()```. It may be useful. What do you think about it?\r\n\r\n@kylelutz, thank you for providing your code. It was helpful."},"comment":{"url":"https://api.github.com/repos/kylelutz/compute/issues/comments/93509858","html_url":"https://github.com/kylelutz/compute/pull/452#issuecomment-93509858","issue_url":"https://api.github.com/repos/kylelutz/compute/issues/452","id":93509858,"user":{"login":"haahh","id":2720260,"avatar_url":"https://avatars.githubusercontent.com/u/2720260?v=3","gravatar_id":"","url":"https://api.github.com/users/haahh","html_url":"https://github.com/haahh","followers_url":"https://api.github.com/users/haahh/followers","following_url":"https://api.github.com/users/haahh/following{/other_user}","gists_url":"https://api.github.com/users/haahh/gists{/gist_id}","starred_url":"https://api.github.com/users/haahh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haahh/subscriptions","organizations_url":"https://api.github.com/users/haahh/orgs","repos_url":"https://api.github.com/users/haahh/repos","events_url":"https://api.github.com/users/haahh/events{/privacy}","received_events_url":"https://api.github.com/users/haahh/received_events","type":"User","site_admin":false},"created_at":"2015-04-15T18:11:10Z","updated_at":"2015-04-15T18:11:10Z","body":"```make_strided_iterator()``` function which takes both the begin and end of the underlying iterator must led to ```strided_iterator``` implementation where increment method would look like this:\r\n\r\n```cpp\r\nvoid increment()\r\n{\r\n   // super_type::base_reference() - underlying iterator referring\r\n   // end - iterator referring to past-the-end element \r\n   auto step = (std::min)(m_stride, end - super_type::base_reference());\r\n   std::advance(super_type::base_reference(), step);\r\n}\r\n```\r\n\r\nOtherwise why we would require end when making strided iterator for begin? And I think only that way we would get strided iterator end for ```make_strided_iterator(end, end, stride)```.\r\n\r\nIn this version end for ```strided_iterator``` made with ```stride = x``` and ```stride = y``` (where ```x != y```) would be the same. My first thought is that can cause problems when someone want to iterate from the end to the begin."}}