16 template <
class T1,
class T2>
17 class Zip : std::pair<T1 &, T2 &> {
19 using iterator1_t = std::conditional_t<std::is_const<T1>::value,
20 typename T1::const_iterator,
21 typename T1::iterator>;
22 using iterator2_t = std::conditional_t<std::is_const<T2>::value,
23 typename T2::const_iterator,
24 typename T2::iterator>;
26 using iparent_t = std::pair<iterator1_t, iterator2_t>;
28 using value_type1 = std::conditional_t<std::is_const<T1>::value,
29 const typename T1::value_type &,
30 typename T1::value_type &>;
32 using value_type2 = std::conditional_t<std::is_const<T2>::value,
33 const typename T2::value_type &,
34 typename T2::value_type &>;
36 using value_pair_t = std::pair<value_type1, value_type2>;
40 iterator(iterator1_t c1, iterator2_t c2) : iparent_t(c1, c2) {}
43 return value_pair_t(*this->first, *this->second);
46 auto operator-> ()
const {
47 auto x = std::make_unique<value_pair_t>(*this->first,
73 operator+(
int x)
const {
74 return iterator(this->first + x, this->second + x);
78 operator-(
int x)
const {
79 return iterator(this->first - x, this->second - x);
83 operator==(
const iterator &x)
const {
84 return static_cast<iparent_t
>(x).first == this->first ||
85 static_cast<iparent_t
>(x).second == this->second;
89 operator!=(
const iterator &x)
const {
90 return static_cast<iparent_t
>(x).first != this->first &&
91 static_cast<iparent_t
>(x).second != this->second;
96 using parent_t = std::pair<T1 &, T2 &>;
97 Zip(T1 &c1, T2 &c2) : parent_t(c1, c2) {}
101 return iterator(this->first.begin(), this->second.begin());
106 return iterator(this->first.end(), this->second.end());
110 template <
typename T =
size_t>
113 using value_type = T;
128 operator ->()
const {
150 operator+(
int x)
const {
155 operator-(
int x)
const {
181 return const_iterator(0);
210 template <
class T1,
class T2>
212 zip(T1 &c1, T2 &c2) {
213 return Zip<T1, T2>(c1, c2);
Definition: aligner.cc:15