
Jeff,
* The traversal category of flat_iterator is supposed to be the 'greatest common divisor' of the inner and outer iterator type. Is there a meta-function in boost that provides that type? [...]
I would describe it as the "widest convertible" type, since the traversal concepts form a linear hiearchy, but that's not to say your description is incorrect ;)
out of curiosity I've implemented the 'widest convertible' meta-function as reformulated greatest common divisor problem (called it widest_convertible_traversal_cat as you suggested though :). It works by declaring a bidirectional mapping from category to id and vice versa. If ids are chosen to be the powers of two then the widest convertible traversal category is the greatest common divisor of both category ids. The code consists of a few lines of code (reusing boost::math::static_gcd) and should be quite fast as far as compile time is concerned (assuming euclids gcd algorithm is used it takes a single iteration). It might be the fastest solution, but a quite elegant one (I think) :) Please find my code with complete test suite attached. Do you think that piece of code might be of general interest? Best regards, Christoph