Boost logo

Boost :

Subject: Re: [boost] [iterator][range] BoostIteratorTraversalConcepts-aware boost::advance/distance
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2017-07-03 22:49:00


On 03/07/2017 8:41, Andrzej Krzemienski via Boost wrote:

> Those Boost iterators provide two distinct tags:
> 1. STL-conformant *iterator tag* (in the case of zip-iterator it is

I don't think so. The following example:

#include <iostream>
#include <boost/iterator/zip_iterator.hpp>
#include <boost/tuple/tuple.hpp>

template<class Iterator>
void print_type(Iterator)
{
    std::cout << typeid(typename Iterator::iterator_category).name() <<
std::endl;
}

int main()
{
   const int N=1;
   int keys[N];
   double values[N];
   print_type(boost::make_zip_iterator(boost::make_tuple(&keys[0],
&values[0])));
   return 0;
}

prints in MSVC 2017

"struct
boost::iterators::detail::iterator_category_with_traversal<struct
std::input_iterator_tag,struct
boost::iterators::random_access_traversal_tag>"

instead of "std::input_iterator_tag". That type inherits from
"std::input_iterator_tag" but it's not an standard tag type, so IMHO,
it's a non-conforming iterator.

Best,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk