|
Boost Users : |
Subject: [Boost-users] [Iterator] zip iterator with std::tuple or std::pair
From: Matthias Wohlgemuth (mail_at_[hidden])
Date: 2017-03-23 13:30:39
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 <boost/iterator/zip_iterator.hpp>
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<std::pair<__gnu_cxx::__normal_iterator<int*,
std::vector<int> >, __gnu_cxx::__normal_iterator<int*, std::vector<int>
> >, 0l>â:
/software/boost-1.62/include/boost/iterator/zip_iterator.hpp:180:17:
required from âstruct
boost::iterators::detail::zip_iterator_base<std::pair<__gnu_cxx::__normal_iterator<int*,
std::vector<int> >, __gnu_cxx::__normal_iterator<int*, std::vector<int>
> > >â
/software/boost-1.62/include/boost/iterator/zip_iterator.hpp:237:9:
required from âclass
boost::iterators::zip_iterator<std::pair<__gnu_cxx::__normal_iterator<int*,
std::vector<int> >, __gnu_cxx::__normal_iterator<int*, std::vector<int>
> > >â
test.cpp:8:64: required from here
/software/boost-1.62/include/boost/mpl/at.hpp:42:8: error: no class
template named âapplyâ in âstruct
boost::mpl::at_impl<boost::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<std::pair<__gnu_cxx::__normal_iterator<int*,
std::vector<int> >, __gnu_cxx::__normal_iterator<int*, std::vector<int>
> > >â:
/software/boost-1.62/include/boost/iterator/zip_iterator.hpp:237:9:
required from âclass
boost::iterators::zip_iterator<std::pair<__gnu_cxx::__normal_iterator<int*,
std::vector<int> >, __gnu_cxx::__normal_iterator<int*, std::vector<int>
> > >â
test.cpp:8:64: required from here
/software/boost-1.62/include/boost/iterator/zip_iterator.hpp:180:17:
error: no type named âtypeâ in âstruct
boost::mpl::at_c<std::pair<__gnu_cxx::__normal_iterator<int*,
std::vector<int> >, __gnu_cxx::__normal_iterator<int*, std::vector<int>
> >, 0l>â
>::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<std::pair<__gnu_cxx::__normal_iterator<int*,
std::vector<int> >, __gnu_cxx::__normal_iterator<int*, std::vector<int>
> >, 0l>â
> 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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net