I tried it out, yes you can get make_iterator_range with next to work. I like boost::next but for what I wanted it does not seem to work appropriately. Your example of "make_iterator_range(boost::next(b.begin, wSize), v.end())" will only skip the first "wSize" elements. What I want is a range that contains at most wSize elements (if possible) - taking them from after (and containing) a start index.
On Tue, Oct 30, 2012 at 3:08 AM, David Kimmel <[hidden email]> wrote:
Whoa fast responses!I like make_iterator_range and sliced but they don't quite seem to do it. Good point on the std::distance. No need to add a new make_iterator_range - I may consider rethinking my approach or just leaving as is. Thanks everyone!make_iterator_range is perfectly capable of meeting your expressed requirements. I have done this many times, I'm not hypothesising. Please see my original post. You just use boost::next to advance one of the iterators that define the range.
While respecting Thorsten's opinion and the wish to provide convenience functions to our users, I'm not keen on introducing make_iterator_range (iterator, size_type) it seems like an unnecessary addition that would not significantly improve syntax. It would also duplicate the logic behind boost::next within non-member functions in Boost.Range like make_iterator_range. I prefer orthogonal solutions and composition to duplication of the advance logic.Neil Groves_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
http://boost.2283326.n4.nabble.com/Iterator-Range-sub-range-of-a-desired-size-tp4637719p4637772.htmlIf you reply to this email, your message will be added to the discussion below: