Hello,
as far as I understand the zip_iterator is compatible also with STL
tuple and pair.
However, when I try to create a zip_iterator with std::pair it fails to
compile.
Here, a simple test code:
#include <vector>
#include <utility>
#include
int main () {
std::vector<int> v(4);
boost::make_zip_iterator(std::make_pair(v.begin(), v.begin()));
return 0;
}
compiled with gcc 4.9.2 and boost 1.62 returns me (tested also with
1.63):
In file included from
/software/boost-1.62/include/boost/iterator/zip_iterator.hpp:26:0,
from test.cpp:3:
/software/boost-1.62/include/boost/mpl/at.hpp: In instantiation of
‘struct boost::mpl::at_c, __gnu_cxx::__normal_iterator
, 0l>’:
/software/boost-1.62/include/boost/iterator/zip_iterator.hpp:180:17:
required from ‘struct
boost::iterators::detail::zip_iterator_base, __gnu_cxx::__normal_iterator
’
/software/boost-1.62/include/boost/iterator/zip_iterator.hpp:237:9:
required from ‘class
boost::iterators::zip_iterator, __gnu_cxx::__normal_iteratorboost::mpl::non_sequence_tag’
struct at_c
^
In file included from test.cpp:3:0:
/software/boost-1.62/include/boost/iterator/zip_iterator.hpp: In
instantiation of ‘struct
boost::iterators::detail::zip_iterator_base, __gnu_cxx::__normal_iterator, __gnu_cxx::__normal_iterator, __gnu_cxx::__normal_iterator’
>::type difference_type;
^
/software/boost-1.62/include/boost/iterator/zip_iterator.hpp:198:11:
error: no type named ‘type’ in ‘struct
boost::mpl::at_c, __gnu_cxx::__normal_iterator’
> type;
I get a similar results for std::tuple compiled c++11 enabled gcc.
I did not find any solution, except a 3 year old patch, which is said to
be applied to the boost::iterator library.
Any suggestions?
Best regards,
Matthias