33 #include <boost/iterator/zip_iterator.hpp>
34 #include <boost/range.hpp>
44 template<
template<
typename,
typename>
class PairType,
typename FirstIt,
typename SecondIt>
45 using ValueType_t = PairType<typename std::iterator_traits<FirstIt>::value_type,
typename std::iterator_traits<SecondIt>::value_type>;
47 template<
template<
typename,
typename>
class PairType,
typename FirstIt,
typename SecondIt>
48 class PairIterator :
public std::iterator<std::forward_iterator_tag, ValueType_t<PairType, FirstIt, SecondIt>>
58 : IsSentinel_ {
true }
62 PairIterator (
const FirstIt& first,
const FirstIt& firstEnd,
63 const SecondIt& second,
const SecondIt& secondEnd)
64 : IsSentinel_ {
false }
66 , FirstEnd_ { firstEnd }
68 , SecondEnd_ { secondEnd }
74 return (
IsSentinel () && other.IsSentinel ()) ||
75 (First_ == other.First_ && Second_ == other.Second_);
80 return !(*
this == other);
85 return IsSentinel_ || First_ == FirstEnd_ || Second_ == SecondEnd_;
105 PairType<typename std::iterator_traits<FirstIt>::value_type,
typename std::iterator_traits<SecondIt>::value_type>
operator* ()
const
107 return { *First_, *Second_ };
111 template<
typename I1,
typename I2,
template<
typename,
typename>
class PairType>
114 using IteratorType_t = PairIterator<PairType, I1, I2>;
116 template<
typename C1,
typename C2>
118 :
boost::iterator_range<IteratorType_t>
120 IteratorType_t { c1.begin (), c1.end (), c2.begin (), c2.end () },
128 template<
template<
typename,
typename>
class PairType = QPair,
typename C1,
typename C2>
129 detail::ZipRange<typename C1::const_iterator, typename C2::const_iterator, PairType>
Zip (
const C1& c1,
const C2& c2)