ryanhaining/cppitertools — pull request #12 by benjones (2014-02-06 00:27:07+00:00)
Title: Added iterator_tags for zip

High level: zip_iter should have the weakest iterator_tag over all of the iterators inside of it. So, if it's a zip of a bunch of vectors, we should be able to use zip_iter as a random_access_iterator

Low level:
There was lots of collateral damage implementing this. Important bits:

A template metaprogram struct to figure out the weakest tag of a set of iterators (I put it in iter_base.hpp)
Added a few missing methods for forward iterators
Got rid of the std::iterator_traits specializations you did and instead put using declarations in the iterator classes (which it sounds like is the preferred approach)
Added a few missing overloads for operator * (const and non const versions) in a bunch of the classes
Addition of conditionally enabled operations for bidirectional and random access iterators to zip

Here's the bad news. This is a breaking change because of the way the c++ stdlib/stl work. In order to sort a zipped range, I had to change the return type of operator * for zip_iter to a wrapped type, so I could add my own swap function, found by ADL. I'm pretty sure you CANNOT return the tuple by reference, and std::swap doesn't work for r-value tuples (which is dumb, since it contains references, see here: http://stackoverflow.com/questions/21588477/swap-temporary-tuples-of-references).

To get almost-equiavelent behavior, I added a get function for my wrapped tuple type which can be found by ADL, so to fix broken code, you should just be able to say using std::get (for any real tuples you have), and replace all your std::get calls to get calls. There's an implicit conversion from my wrapper to std::tuple, but it doesn't work with template deduction, so it's basically useless.

Emacs apparently hates your formatting and did its best to wreck it. If you know an easy way to fix it, I'm happy to fix everything and push another revision.

If the breaking change is a dealbreaker, the rest of the stuff I added should still be useful, I think. I suspect there's other reason's you'd want to use higher-level iterators than sorting (although that's why I bothered implementing what I did).