Boost logo

Boost :

Subject: [boost] [iterator] Using zip_iterator with std::pair
From: Claas H. Köhler (claas.koehler_at_[hidden])
Date: 2012-10-16 04:06:55


Hi!

I would like to use the boost::zip_iterator with std::pair. Unfortunately this does not work out of
the box, but there exists a namespace boost::detail::tuple_impl_specific, which apparently needs to
be specialised for each tuple type.

I managed to re-implement tuple_meta_transform and tuple_meta_accumulate for std::tuple, which seems
to be straightforward. However, there are functions of the form

template<typename Tuple, typename Fun>
complex_result_type tuple_transform(const Tuple&, Fun)

which have to be overloaded as well, if I am not mistaken. However, overloading this with something like
template<typename... Args, typename Fun>
complex_result_type tuple_transform(const std::tuple<Args...>&, Fun)

is probably not going to work, since this would be a partial template specialisation of a function.
What is the recommended way of proceeding here?

Or am I making things to complicated and there exists a simpler solution to using the zip iterator
with std::pair / std::tuple.

Any support would be appreciated.

Regards
Claas

P.S: I am using boost 1.50 with gcc-4.6 and the C++11 standard.


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