1*2d1272b8SAndroid Build Coastguard Worker /*
2*2d1272b8SAndroid Build Coastguard Worker * Copyright © 2018 Google, Inc.
3*2d1272b8SAndroid Build Coastguard Worker * Copyright © 2019 Facebook, Inc.
4*2d1272b8SAndroid Build Coastguard Worker *
5*2d1272b8SAndroid Build Coastguard Worker * This is part of HarfBuzz, a text shaping library.
6*2d1272b8SAndroid Build Coastguard Worker *
7*2d1272b8SAndroid Build Coastguard Worker * Permission is hereby granted, without written agreement and without
8*2d1272b8SAndroid Build Coastguard Worker * license or royalty fees, to use, copy, modify, and distribute this
9*2d1272b8SAndroid Build Coastguard Worker * software and its documentation for any purpose, provided that the
10*2d1272b8SAndroid Build Coastguard Worker * above copyright notice and the following two paragraphs appear in
11*2d1272b8SAndroid Build Coastguard Worker * all copies of this software.
12*2d1272b8SAndroid Build Coastguard Worker *
13*2d1272b8SAndroid Build Coastguard Worker * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14*2d1272b8SAndroid Build Coastguard Worker * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15*2d1272b8SAndroid Build Coastguard Worker * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16*2d1272b8SAndroid Build Coastguard Worker * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17*2d1272b8SAndroid Build Coastguard Worker * DAMAGE.
18*2d1272b8SAndroid Build Coastguard Worker *
19*2d1272b8SAndroid Build Coastguard Worker * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20*2d1272b8SAndroid Build Coastguard Worker * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21*2d1272b8SAndroid Build Coastguard Worker * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
22*2d1272b8SAndroid Build Coastguard Worker * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23*2d1272b8SAndroid Build Coastguard Worker * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24*2d1272b8SAndroid Build Coastguard Worker *
25*2d1272b8SAndroid Build Coastguard Worker * Google Author(s): Behdad Esfahbod
26*2d1272b8SAndroid Build Coastguard Worker * Facebook Author(s): Behdad Esfahbod
27*2d1272b8SAndroid Build Coastguard Worker */
28*2d1272b8SAndroid Build Coastguard Worker
29*2d1272b8SAndroid Build Coastguard Worker #ifndef HB_ITER_HH
30*2d1272b8SAndroid Build Coastguard Worker #define HB_ITER_HH
31*2d1272b8SAndroid Build Coastguard Worker
32*2d1272b8SAndroid Build Coastguard Worker #include "hb.hh"
33*2d1272b8SAndroid Build Coastguard Worker #include "hb-algs.hh"
34*2d1272b8SAndroid Build Coastguard Worker #include "hb-meta.hh"
35*2d1272b8SAndroid Build Coastguard Worker
36*2d1272b8SAndroid Build Coastguard Worker
37*2d1272b8SAndroid Build Coastguard Worker /* Unified iterator object.
38*2d1272b8SAndroid Build Coastguard Worker *
39*2d1272b8SAndroid Build Coastguard Worker * The goal of this template is to make the same iterator interface
40*2d1272b8SAndroid Build Coastguard Worker * available to all types, and make it very easy and compact to use.
41*2d1272b8SAndroid Build Coastguard Worker * hb_iter_tator objects are small, light-weight, objects that can be
42*2d1272b8SAndroid Build Coastguard Worker * copied by value. If the collection / object being iterated on
43*2d1272b8SAndroid Build Coastguard Worker * is writable, then the iterator returns lvalues, otherwise it
44*2d1272b8SAndroid Build Coastguard Worker * returns rvalues.
45*2d1272b8SAndroid Build Coastguard Worker *
46*2d1272b8SAndroid Build Coastguard Worker * If iterator implementation implements operator!=, then it can be
47*2d1272b8SAndroid Build Coastguard Worker * used in range-based for loop. That already happens if the iterator
48*2d1272b8SAndroid Build Coastguard Worker * is random-access. Otherwise, the range-based for loop incurs
49*2d1272b8SAndroid Build Coastguard Worker * one traversal to find end(), which can be avoided if written
50*2d1272b8SAndroid Build Coastguard Worker * as a while-style for loop, or if iterator implements a faster
51*2d1272b8SAndroid Build Coastguard Worker * __end__() method. */
52*2d1272b8SAndroid Build Coastguard Worker
53*2d1272b8SAndroid Build Coastguard Worker /*
54*2d1272b8SAndroid Build Coastguard Worker * Base classes for iterators.
55*2d1272b8SAndroid Build Coastguard Worker */
56*2d1272b8SAndroid Build Coastguard Worker
57*2d1272b8SAndroid Build Coastguard Worker /* Base class for all iterators. */
58*2d1272b8SAndroid Build Coastguard Worker template <typename iter_t, typename Item = typename iter_t::__item_t__>
59*2d1272b8SAndroid Build Coastguard Worker struct hb_iter_t
60*2d1272b8SAndroid Build Coastguard Worker {
61*2d1272b8SAndroid Build Coastguard Worker typedef Item item_t;
get_item_sizehb_iter_t62*2d1272b8SAndroid Build Coastguard Worker constexpr unsigned get_item_size () const { return hb_static_size (Item); }
63*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_iterator = true;
64*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_random_access_iterator = false;
65*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_sorted_iterator = false;
66*2d1272b8SAndroid Build Coastguard Worker static constexpr bool has_fast_len = false; // Should be checked in combination with is_random_access_iterator.
67*2d1272b8SAndroid Build Coastguard Worker
68*2d1272b8SAndroid Build Coastguard Worker private:
69*2d1272b8SAndroid Build Coastguard Worker /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
thizhb_iter_t70*2d1272b8SAndroid Build Coastguard Worker const iter_t* thiz () const { return static_cast<const iter_t *> (this); }
thizhb_iter_t71*2d1272b8SAndroid Build Coastguard Worker iter_t* thiz () { return static_cast< iter_t *> (this); }
72*2d1272b8SAndroid Build Coastguard Worker public:
73*2d1272b8SAndroid Build Coastguard Worker
74*2d1272b8SAndroid Build Coastguard Worker /* Operators. */
iterhb_iter_t75*2d1272b8SAndroid Build Coastguard Worker iter_t iter () const { return *thiz(); }
operator +hb_iter_t76*2d1272b8SAndroid Build Coastguard Worker iter_t operator + () const { return *thiz(); }
_beginhb_iter_t77*2d1272b8SAndroid Build Coastguard Worker iter_t _begin () const { return *thiz(); }
beginhb_iter_t78*2d1272b8SAndroid Build Coastguard Worker iter_t begin () const { return _begin (); }
_endhb_iter_t79*2d1272b8SAndroid Build Coastguard Worker iter_t _end () const { return thiz()->__end__ (); }
endhb_iter_t80*2d1272b8SAndroid Build Coastguard Worker iter_t end () const { return _end (); }
operator boolhb_iter_t81*2d1272b8SAndroid Build Coastguard Worker explicit operator bool () const { return thiz()->__more__ (); }
lenhb_iter_t82*2d1272b8SAndroid Build Coastguard Worker unsigned len () const { return thiz()->__len__ (); }
83*2d1272b8SAndroid Build Coastguard Worker /* The following can only be enabled if item_t is reference type. Otherwise
84*2d1272b8SAndroid Build Coastguard Worker * it will be returning pointer to temporary rvalue. */
85*2d1272b8SAndroid Build Coastguard Worker template <typename T = item_t,
86*2d1272b8SAndroid Build Coastguard Worker hb_enable_if (std::is_reference<T>::value)>
operator ->hb_iter_t87*2d1272b8SAndroid Build Coastguard Worker hb_remove_reference<item_t>* operator -> () const { return std::addressof (**thiz()); }
operator *hb_iter_t88*2d1272b8SAndroid Build Coastguard Worker item_t operator * () const { return thiz()->__item__ (); }
operator *hb_iter_t89*2d1272b8SAndroid Build Coastguard Worker item_t operator * () { return thiz()->__item__ (); }
operator []hb_iter_t90*2d1272b8SAndroid Build Coastguard Worker item_t operator [] (unsigned i) const { return thiz()->__item_at__ (i); }
operator []hb_iter_t91*2d1272b8SAndroid Build Coastguard Worker item_t operator [] (unsigned i) { return thiz()->__item_at__ (i); }
operator +=hb_iter_t92*2d1272b8SAndroid Build Coastguard Worker iter_t& operator += (unsigned count) & { thiz()->__forward__ (count); return *thiz(); }
operator +=hb_iter_t93*2d1272b8SAndroid Build Coastguard Worker iter_t operator += (unsigned count) && { thiz()->__forward__ (count); return *thiz(); }
operator ++hb_iter_t94*2d1272b8SAndroid Build Coastguard Worker iter_t& operator ++ () & { thiz()->__next__ (); return *thiz(); }
operator ++hb_iter_t95*2d1272b8SAndroid Build Coastguard Worker iter_t operator ++ () && { thiz()->__next__ (); return *thiz(); }
operator -=hb_iter_t96*2d1272b8SAndroid Build Coastguard Worker iter_t& operator -= (unsigned count) & { thiz()->__rewind__ (count); return *thiz(); }
operator -=hb_iter_t97*2d1272b8SAndroid Build Coastguard Worker iter_t operator -= (unsigned count) && { thiz()->__rewind__ (count); return *thiz(); }
operator --hb_iter_t98*2d1272b8SAndroid Build Coastguard Worker iter_t& operator -- () & { thiz()->__prev__ (); return *thiz(); }
operator --hb_iter_t99*2d1272b8SAndroid Build Coastguard Worker iter_t operator -- () && { thiz()->__prev__ (); return *thiz(); }
operator +hb_iter_t100*2d1272b8SAndroid Build Coastguard Worker iter_t operator + (unsigned count) const { auto c = thiz()->iter (); c += count; return c; }
operator +(unsigned count,const iter_t & it)101*2d1272b8SAndroid Build Coastguard Worker friend iter_t operator + (unsigned count, const iter_t &it) { return it + count; }
operator ++hb_iter_t102*2d1272b8SAndroid Build Coastguard Worker iter_t operator ++ (int) { iter_t c (*thiz()); ++*thiz(); return c; }
operator -hb_iter_t103*2d1272b8SAndroid Build Coastguard Worker iter_t operator - (unsigned count) const { auto c = thiz()->iter (); c -= count; return c; }
operator --hb_iter_t104*2d1272b8SAndroid Build Coastguard Worker iter_t operator -- (int) { iter_t c (*thiz()); --*thiz(); return c; }
105*2d1272b8SAndroid Build Coastguard Worker template <typename T>
operator >>hb_iter_t106*2d1272b8SAndroid Build Coastguard Worker iter_t& operator >> (T &v) & { v = **thiz(); ++*thiz(); return *thiz(); }
107*2d1272b8SAndroid Build Coastguard Worker template <typename T>
operator >>hb_iter_t108*2d1272b8SAndroid Build Coastguard Worker iter_t operator >> (T &v) && { v = **thiz(); ++*thiz(); return *thiz(); }
109*2d1272b8SAndroid Build Coastguard Worker template <typename T>
operator <<hb_iter_t110*2d1272b8SAndroid Build Coastguard Worker iter_t& operator << (const T v) & { **thiz() = v; ++*thiz(); return *thiz(); }
111*2d1272b8SAndroid Build Coastguard Worker template <typename T>
operator <<hb_iter_t112*2d1272b8SAndroid Build Coastguard Worker iter_t operator << (const T v) && { **thiz() = v; ++*thiz(); return *thiz(); }
113*2d1272b8SAndroid Build Coastguard Worker
114*2d1272b8SAndroid Build Coastguard Worker protected:
115*2d1272b8SAndroid Build Coastguard Worker hb_iter_t () = default;
116*2d1272b8SAndroid Build Coastguard Worker hb_iter_t (const hb_iter_t &o HB_UNUSED) = default;
117*2d1272b8SAndroid Build Coastguard Worker hb_iter_t (hb_iter_t &&o HB_UNUSED) = default;
118*2d1272b8SAndroid Build Coastguard Worker hb_iter_t& operator = (const hb_iter_t &o HB_UNUSED) = default;
119*2d1272b8SAndroid Build Coastguard Worker hb_iter_t& operator = (hb_iter_t &&o HB_UNUSED) = default;
120*2d1272b8SAndroid Build Coastguard Worker };
121*2d1272b8SAndroid Build Coastguard Worker
122*2d1272b8SAndroid Build Coastguard Worker #define HB_ITER_USING(Name) \
123*2d1272b8SAndroid Build Coastguard Worker using item_t = typename Name::item_t; \
124*2d1272b8SAndroid Build Coastguard Worker using Name::_begin; \
125*2d1272b8SAndroid Build Coastguard Worker using Name::begin; \
126*2d1272b8SAndroid Build Coastguard Worker using Name::_end; \
127*2d1272b8SAndroid Build Coastguard Worker using Name::end; \
128*2d1272b8SAndroid Build Coastguard Worker using Name::get_item_size; \
129*2d1272b8SAndroid Build Coastguard Worker using Name::is_iterator; \
130*2d1272b8SAndroid Build Coastguard Worker using Name::iter; \
131*2d1272b8SAndroid Build Coastguard Worker using Name::operator bool; \
132*2d1272b8SAndroid Build Coastguard Worker using Name::len; \
133*2d1272b8SAndroid Build Coastguard Worker using Name::operator ->; \
134*2d1272b8SAndroid Build Coastguard Worker using Name::operator *; \
135*2d1272b8SAndroid Build Coastguard Worker using Name::operator []; \
136*2d1272b8SAndroid Build Coastguard Worker using Name::operator +=; \
137*2d1272b8SAndroid Build Coastguard Worker using Name::operator ++; \
138*2d1272b8SAndroid Build Coastguard Worker using Name::operator -=; \
139*2d1272b8SAndroid Build Coastguard Worker using Name::operator --; \
140*2d1272b8SAndroid Build Coastguard Worker using Name::operator +; \
141*2d1272b8SAndroid Build Coastguard Worker using Name::operator -; \
142*2d1272b8SAndroid Build Coastguard Worker using Name::operator >>; \
143*2d1272b8SAndroid Build Coastguard Worker using Name::operator <<; \
144*2d1272b8SAndroid Build Coastguard Worker static_assert (true, "")
145*2d1272b8SAndroid Build Coastguard Worker
146*2d1272b8SAndroid Build Coastguard Worker /* Returns iterator / item type of a type. */
147*2d1272b8SAndroid Build Coastguard Worker template <typename Iterable>
148*2d1272b8SAndroid Build Coastguard Worker using hb_iter_type = decltype (hb_deref (hb_declval (Iterable)).iter ());
149*2d1272b8SAndroid Build Coastguard Worker template <typename Iterable>
150*2d1272b8SAndroid Build Coastguard Worker using hb_item_type = decltype (*hb_deref (hb_declval (Iterable)).iter ());
151*2d1272b8SAndroid Build Coastguard Worker
152*2d1272b8SAndroid Build Coastguard Worker
153*2d1272b8SAndroid Build Coastguard Worker template <typename> struct hb_array_t;
154*2d1272b8SAndroid Build Coastguard Worker template <typename> struct hb_sorted_array_t;
155*2d1272b8SAndroid Build Coastguard Worker
156*2d1272b8SAndroid Build Coastguard Worker struct
157*2d1272b8SAndroid Build Coastguard Worker {
158*2d1272b8SAndroid Build Coastguard Worker template <typename T> hb_iter_type<T>
operator ()__anon3e77a5160108159*2d1272b8SAndroid Build Coastguard Worker operator () (T&& c) const
160*2d1272b8SAndroid Build Coastguard Worker { return hb_deref (std::forward<T> (c)).iter (); }
161*2d1272b8SAndroid Build Coastguard Worker
162*2d1272b8SAndroid Build Coastguard Worker /* Specialization for C arrays. */
163*2d1272b8SAndroid Build Coastguard Worker
164*2d1272b8SAndroid Build Coastguard Worker template <typename Type> inline hb_array_t<Type>
operator ()__anon3e77a5160108165*2d1272b8SAndroid Build Coastguard Worker operator () (Type *array, unsigned int length) const
166*2d1272b8SAndroid Build Coastguard Worker { return hb_array_t<Type> (array, length); }
167*2d1272b8SAndroid Build Coastguard Worker
168*2d1272b8SAndroid Build Coastguard Worker template <typename Type, unsigned int length> hb_array_t<Type>
operator ()__anon3e77a5160108169*2d1272b8SAndroid Build Coastguard Worker operator () (Type (&array)[length]) const
170*2d1272b8SAndroid Build Coastguard Worker { return hb_array_t<Type> (array, length); }
171*2d1272b8SAndroid Build Coastguard Worker
172*2d1272b8SAndroid Build Coastguard Worker }
173*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_iter);
174*2d1272b8SAndroid Build Coastguard Worker struct
175*2d1272b8SAndroid Build Coastguard Worker {
176*2d1272b8SAndroid Build Coastguard Worker template <typename T> auto
177*2d1272b8SAndroid Build Coastguard Worker impl (T&& c, hb_priority<1>) const HB_RETURN (unsigned, c.len ())
178*2d1272b8SAndroid Build Coastguard Worker
179*2d1272b8SAndroid Build Coastguard Worker template <typename T> auto
180*2d1272b8SAndroid Build Coastguard Worker impl (T&& c, hb_priority<0>) const HB_RETURN (unsigned, c.len)
181*2d1272b8SAndroid Build Coastguard Worker
182*2d1272b8SAndroid Build Coastguard Worker public:
183*2d1272b8SAndroid Build Coastguard Worker
184*2d1272b8SAndroid Build Coastguard Worker template <typename T> auto
185*2d1272b8SAndroid Build Coastguard Worker operator () (T&& c) const HB_RETURN (unsigned, impl (std::forward<T> (c), hb_prioritize))
186*2d1272b8SAndroid Build Coastguard Worker }
187*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_len);
188*2d1272b8SAndroid Build Coastguard Worker
189*2d1272b8SAndroid Build Coastguard Worker /* Mixin to fill in what the subclass doesn't provide. */
190*2d1272b8SAndroid Build Coastguard Worker template <typename iter_t, typename item_t = typename iter_t::__item_t__>
191*2d1272b8SAndroid Build Coastguard Worker struct hb_iter_fallback_mixin_t
192*2d1272b8SAndroid Build Coastguard Worker {
193*2d1272b8SAndroid Build Coastguard Worker private:
194*2d1272b8SAndroid Build Coastguard Worker /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
thizhb_iter_fallback_mixin_t195*2d1272b8SAndroid Build Coastguard Worker const iter_t* thiz () const { return static_cast<const iter_t *> (this); }
thizhb_iter_fallback_mixin_t196*2d1272b8SAndroid Build Coastguard Worker iter_t* thiz () { return static_cast< iter_t *> (this); }
197*2d1272b8SAndroid Build Coastguard Worker public:
198*2d1272b8SAndroid Build Coastguard Worker
199*2d1272b8SAndroid Build Coastguard Worker /* Access: Implement __item__(), or __item_at__() if random-access. */
__item__hb_iter_fallback_mixin_t200*2d1272b8SAndroid Build Coastguard Worker item_t __item__ () const { return (*thiz())[0]; }
__item_at__hb_iter_fallback_mixin_t201*2d1272b8SAndroid Build Coastguard Worker item_t __item_at__ (unsigned i) const { return *(*thiz() + i); }
202*2d1272b8SAndroid Build Coastguard Worker
203*2d1272b8SAndroid Build Coastguard Worker /* Termination: Implement __more__(), or __len__() if random-access. */
__more__hb_iter_fallback_mixin_t204*2d1272b8SAndroid Build Coastguard Worker bool __more__ () const { return bool (thiz()->len ()); }
__len__hb_iter_fallback_mixin_t205*2d1272b8SAndroid Build Coastguard Worker unsigned __len__ () const
206*2d1272b8SAndroid Build Coastguard Worker { iter_t c (*thiz()); unsigned l = 0; while (c) { c++; l++; } return l; }
207*2d1272b8SAndroid Build Coastguard Worker
208*2d1272b8SAndroid Build Coastguard Worker /* Advancing: Implement __next__(), or __forward__() if random-access. */
__next__hb_iter_fallback_mixin_t209*2d1272b8SAndroid Build Coastguard Worker void __next__ () { *thiz() += 1; }
__forward__hb_iter_fallback_mixin_t210*2d1272b8SAndroid Build Coastguard Worker void __forward__ (unsigned n) { while (*thiz() && n--) ++*thiz(); }
211*2d1272b8SAndroid Build Coastguard Worker
212*2d1272b8SAndroid Build Coastguard Worker /* Rewinding: Implement __prev__() or __rewind__() if bidirectional. */
__prev__hb_iter_fallback_mixin_t213*2d1272b8SAndroid Build Coastguard Worker void __prev__ () { *thiz() -= 1; }
__rewind__hb_iter_fallback_mixin_t214*2d1272b8SAndroid Build Coastguard Worker void __rewind__ (unsigned n) { while (*thiz() && n--) --*thiz(); }
215*2d1272b8SAndroid Build Coastguard Worker
216*2d1272b8SAndroid Build Coastguard Worker /* Range-based for: Implement __end__() if can be done faster,
217*2d1272b8SAndroid Build Coastguard Worker * and operator!=. */
__end__hb_iter_fallback_mixin_t218*2d1272b8SAndroid Build Coastguard Worker iter_t __end__ () const
219*2d1272b8SAndroid Build Coastguard Worker {
220*2d1272b8SAndroid Build Coastguard Worker if (thiz()->is_random_access_iterator)
221*2d1272b8SAndroid Build Coastguard Worker return *thiz() + thiz()->len ();
222*2d1272b8SAndroid Build Coastguard Worker /* Above expression loops twice. Following loops once. */
223*2d1272b8SAndroid Build Coastguard Worker auto it = *thiz();
224*2d1272b8SAndroid Build Coastguard Worker while (it) ++it;
225*2d1272b8SAndroid Build Coastguard Worker return it;
226*2d1272b8SAndroid Build Coastguard Worker }
227*2d1272b8SAndroid Build Coastguard Worker
228*2d1272b8SAndroid Build Coastguard Worker protected:
229*2d1272b8SAndroid Build Coastguard Worker hb_iter_fallback_mixin_t () = default;
230*2d1272b8SAndroid Build Coastguard Worker hb_iter_fallback_mixin_t (const hb_iter_fallback_mixin_t &o HB_UNUSED) = default;
231*2d1272b8SAndroid Build Coastguard Worker hb_iter_fallback_mixin_t (hb_iter_fallback_mixin_t &&o HB_UNUSED) = default;
232*2d1272b8SAndroid Build Coastguard Worker hb_iter_fallback_mixin_t& operator = (const hb_iter_fallback_mixin_t &o HB_UNUSED) = default;
233*2d1272b8SAndroid Build Coastguard Worker hb_iter_fallback_mixin_t& operator = (hb_iter_fallback_mixin_t &&o HB_UNUSED) = default;
234*2d1272b8SAndroid Build Coastguard Worker };
235*2d1272b8SAndroid Build Coastguard Worker
236*2d1272b8SAndroid Build Coastguard Worker template <typename iter_t, typename item_t = typename iter_t::__item_t__>
237*2d1272b8SAndroid Build Coastguard Worker struct hb_iter_with_fallback_t :
238*2d1272b8SAndroid Build Coastguard Worker hb_iter_t<iter_t, item_t>,
239*2d1272b8SAndroid Build Coastguard Worker hb_iter_fallback_mixin_t<iter_t, item_t>
240*2d1272b8SAndroid Build Coastguard Worker {
241*2d1272b8SAndroid Build Coastguard Worker protected:
242*2d1272b8SAndroid Build Coastguard Worker hb_iter_with_fallback_t () = default;
243*2d1272b8SAndroid Build Coastguard Worker hb_iter_with_fallback_t (const hb_iter_with_fallback_t &o HB_UNUSED) = default;
244*2d1272b8SAndroid Build Coastguard Worker hb_iter_with_fallback_t (hb_iter_with_fallback_t &&o HB_UNUSED) = default;
245*2d1272b8SAndroid Build Coastguard Worker hb_iter_with_fallback_t& operator = (const hb_iter_with_fallback_t &o HB_UNUSED) = default;
246*2d1272b8SAndroid Build Coastguard Worker hb_iter_with_fallback_t& operator = (hb_iter_with_fallback_t &&o HB_UNUSED) = default;
247*2d1272b8SAndroid Build Coastguard Worker };
248*2d1272b8SAndroid Build Coastguard Worker
249*2d1272b8SAndroid Build Coastguard Worker /*
250*2d1272b8SAndroid Build Coastguard Worker * Meta-programming predicates.
251*2d1272b8SAndroid Build Coastguard Worker */
252*2d1272b8SAndroid Build Coastguard Worker
253*2d1272b8SAndroid Build Coastguard Worker /* hb_is_iterator() / hb_is_iterator_of() */
254*2d1272b8SAndroid Build Coastguard Worker
255*2d1272b8SAndroid Build Coastguard Worker template<typename Iter, typename Item>
256*2d1272b8SAndroid Build Coastguard Worker struct hb_is_iterator_of
257*2d1272b8SAndroid Build Coastguard Worker {
258*2d1272b8SAndroid Build Coastguard Worker template <typename Item2 = Item>
259*2d1272b8SAndroid Build Coastguard Worker static hb_true_type impl (hb_priority<2>, hb_iter_t<Iter, hb_type_identity<Item2>> *);
260*2d1272b8SAndroid Build Coastguard Worker static hb_false_type impl (hb_priority<0>, const void *);
261*2d1272b8SAndroid Build Coastguard Worker
262*2d1272b8SAndroid Build Coastguard Worker public:
263*2d1272b8SAndroid Build Coastguard Worker static constexpr bool value = decltype (impl (hb_prioritize, hb_declval (Iter*)))::value;
264*2d1272b8SAndroid Build Coastguard Worker };
265*2d1272b8SAndroid Build Coastguard Worker #define hb_is_iterator_of(Iter, Item) hb_is_iterator_of<Iter, Item>::value
266*2d1272b8SAndroid Build Coastguard Worker #define hb_is_iterator(Iter) hb_is_iterator_of (Iter, typename Iter::item_t)
267*2d1272b8SAndroid Build Coastguard Worker #define hb_is_sorted_iterator_of(Iter, Item) (hb_is_iterator_of<Iter, Item>::value && Iter::is_sorted_iterator)
268*2d1272b8SAndroid Build Coastguard Worker #define hb_is_sorted_iterator(Iter) hb_is_sorted_iterator_of (Iter, typename Iter::item_t)
269*2d1272b8SAndroid Build Coastguard Worker
270*2d1272b8SAndroid Build Coastguard Worker /* hb_is_iterable() */
271*2d1272b8SAndroid Build Coastguard Worker
272*2d1272b8SAndroid Build Coastguard Worker template <typename T>
273*2d1272b8SAndroid Build Coastguard Worker struct hb_is_iterable
274*2d1272b8SAndroid Build Coastguard Worker {
275*2d1272b8SAndroid Build Coastguard Worker private:
276*2d1272b8SAndroid Build Coastguard Worker
277*2d1272b8SAndroid Build Coastguard Worker template <typename U>
278*2d1272b8SAndroid Build Coastguard Worker static auto impl (hb_priority<1>) -> decltype (hb_declval (U).iter (), hb_true_type ());
279*2d1272b8SAndroid Build Coastguard Worker
280*2d1272b8SAndroid Build Coastguard Worker template <typename>
281*2d1272b8SAndroid Build Coastguard Worker static hb_false_type impl (hb_priority<0>);
282*2d1272b8SAndroid Build Coastguard Worker
283*2d1272b8SAndroid Build Coastguard Worker public:
284*2d1272b8SAndroid Build Coastguard Worker static constexpr bool value = decltype (impl<T> (hb_prioritize))::value;
285*2d1272b8SAndroid Build Coastguard Worker };
286*2d1272b8SAndroid Build Coastguard Worker #define hb_is_iterable(Iterable) hb_is_iterable<Iterable>::value
287*2d1272b8SAndroid Build Coastguard Worker
288*2d1272b8SAndroid Build Coastguard Worker /* hb_is_source_of() / hb_is_sink_of() */
289*2d1272b8SAndroid Build Coastguard Worker
290*2d1272b8SAndroid Build Coastguard Worker template<typename Iter, typename Item>
291*2d1272b8SAndroid Build Coastguard Worker struct hb_is_source_of
292*2d1272b8SAndroid Build Coastguard Worker {
293*2d1272b8SAndroid Build Coastguard Worker private:
294*2d1272b8SAndroid Build Coastguard Worker template <typename Iter2 = Iter,
295*2d1272b8SAndroid Build Coastguard Worker hb_enable_if (hb_is_convertible (typename Iter2::item_t, hb_add_lvalue_reference<const Item>))>
296*2d1272b8SAndroid Build Coastguard Worker static hb_true_type impl (hb_priority<2>);
297*2d1272b8SAndroid Build Coastguard Worker template <typename Iter2 = Iter>
298*2d1272b8SAndroid Build Coastguard Worker static auto impl (hb_priority<1>) -> decltype (hb_declval (Iter2) >> hb_declval (Item &), hb_true_type ());
299*2d1272b8SAndroid Build Coastguard Worker static hb_false_type impl (hb_priority<0>);
300*2d1272b8SAndroid Build Coastguard Worker
301*2d1272b8SAndroid Build Coastguard Worker public:
302*2d1272b8SAndroid Build Coastguard Worker static constexpr bool value = decltype (impl (hb_prioritize))::value;
303*2d1272b8SAndroid Build Coastguard Worker };
304*2d1272b8SAndroid Build Coastguard Worker #define hb_is_source_of(Iter, Item) hb_is_source_of<Iter, Item>::value
305*2d1272b8SAndroid Build Coastguard Worker
306*2d1272b8SAndroid Build Coastguard Worker template<typename Iter, typename Item>
307*2d1272b8SAndroid Build Coastguard Worker struct hb_is_sink_of
308*2d1272b8SAndroid Build Coastguard Worker {
309*2d1272b8SAndroid Build Coastguard Worker private:
310*2d1272b8SAndroid Build Coastguard Worker template <typename Iter2 = Iter,
311*2d1272b8SAndroid Build Coastguard Worker hb_enable_if (hb_is_convertible (typename Iter2::item_t, hb_add_lvalue_reference<Item>))>
312*2d1272b8SAndroid Build Coastguard Worker static hb_true_type impl (hb_priority<2>);
313*2d1272b8SAndroid Build Coastguard Worker template <typename Iter2 = Iter>
314*2d1272b8SAndroid Build Coastguard Worker static auto impl (hb_priority<1>) -> decltype (hb_declval (Iter2) << hb_declval (Item), hb_true_type ());
315*2d1272b8SAndroid Build Coastguard Worker static hb_false_type impl (hb_priority<0>);
316*2d1272b8SAndroid Build Coastguard Worker
317*2d1272b8SAndroid Build Coastguard Worker public:
318*2d1272b8SAndroid Build Coastguard Worker static constexpr bool value = decltype (impl (hb_prioritize))::value;
319*2d1272b8SAndroid Build Coastguard Worker };
320*2d1272b8SAndroid Build Coastguard Worker #define hb_is_sink_of(Iter, Item) hb_is_sink_of<Iter, Item>::value
321*2d1272b8SAndroid Build Coastguard Worker
322*2d1272b8SAndroid Build Coastguard Worker /* This is commonly used, so define: */
323*2d1272b8SAndroid Build Coastguard Worker #define hb_is_sorted_source_of(Iter, Item) \
324*2d1272b8SAndroid Build Coastguard Worker (hb_is_source_of(Iter, Item) && Iter::is_sorted_iterator)
325*2d1272b8SAndroid Build Coastguard Worker
326*2d1272b8SAndroid Build Coastguard Worker
327*2d1272b8SAndroid Build Coastguard Worker struct
328*2d1272b8SAndroid Build Coastguard Worker {
329*2d1272b8SAndroid Build Coastguard Worker template <typename Iterable,
330*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (Iterable))>
operator ()__anon3e77a5160308331*2d1272b8SAndroid Build Coastguard Worker unsigned operator () (const Iterable &_) const { return hb_len (hb_iter (_)); }
332*2d1272b8SAndroid Build Coastguard Worker
operator ()__anon3e77a5160308333*2d1272b8SAndroid Build Coastguard Worker unsigned operator () (unsigned _) const { return _; }
334*2d1272b8SAndroid Build Coastguard Worker }
335*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_len_of);
336*2d1272b8SAndroid Build Coastguard Worker
337*2d1272b8SAndroid Build Coastguard Worker /* Range-based 'for' for iterables. */
338*2d1272b8SAndroid Build Coastguard Worker
339*2d1272b8SAndroid Build Coastguard Worker template <typename Iterable,
340*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (Iterable))>
341*2d1272b8SAndroid Build Coastguard Worker static inline auto begin (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).begin ())
342*2d1272b8SAndroid Build Coastguard Worker
343*2d1272b8SAndroid Build Coastguard Worker template <typename Iterable,
344*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (Iterable))>
345*2d1272b8SAndroid Build Coastguard Worker static inline auto end (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).end ())
346*2d1272b8SAndroid Build Coastguard Worker
347*2d1272b8SAndroid Build Coastguard Worker /* begin()/end() are NOT looked up non-ADL. So each namespace must declare them.
348*2d1272b8SAndroid Build Coastguard Worker * Do it for namespace OT. */
349*2d1272b8SAndroid Build Coastguard Worker namespace OT {
350*2d1272b8SAndroid Build Coastguard Worker
351*2d1272b8SAndroid Build Coastguard Worker template <typename Iterable,
352*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (Iterable))>
353*2d1272b8SAndroid Build Coastguard Worker static inline auto begin (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).begin ())
354*2d1272b8SAndroid Build Coastguard Worker
355*2d1272b8SAndroid Build Coastguard Worker template <typename Iterable,
356*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (Iterable))>
357*2d1272b8SAndroid Build Coastguard Worker static inline auto end (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).end ())
358*2d1272b8SAndroid Build Coastguard Worker
359*2d1272b8SAndroid Build Coastguard Worker }
360*2d1272b8SAndroid Build Coastguard Worker
361*2d1272b8SAndroid Build Coastguard Worker
362*2d1272b8SAndroid Build Coastguard Worker /*
363*2d1272b8SAndroid Build Coastguard Worker * Adaptors, combiners, etc.
364*2d1272b8SAndroid Build Coastguard Worker */
365*2d1272b8SAndroid Build Coastguard Worker
366*2d1272b8SAndroid Build Coastguard Worker template <typename Lhs, typename Rhs,
367*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterator (Lhs))>
368*2d1272b8SAndroid Build Coastguard Worker static inline auto
369*2d1272b8SAndroid Build Coastguard Worker operator | (Lhs&& lhs, Rhs&& rhs) HB_AUTO_RETURN (std::forward<Rhs> (rhs) (std::forward<Lhs> (lhs)))
370*2d1272b8SAndroid Build Coastguard Worker
371*2d1272b8SAndroid Build Coastguard Worker /* hb_map(), hb_filter(), hb_reduce() */
372*2d1272b8SAndroid Build Coastguard Worker
373*2d1272b8SAndroid Build Coastguard Worker enum class hb_function_sortedness_t {
374*2d1272b8SAndroid Build Coastguard Worker NOT_SORTED,
375*2d1272b8SAndroid Build Coastguard Worker RETAINS_SORTING,
376*2d1272b8SAndroid Build Coastguard Worker SORTED,
377*2d1272b8SAndroid Build Coastguard Worker };
378*2d1272b8SAndroid Build Coastguard Worker
379*2d1272b8SAndroid Build Coastguard Worker template <typename Iter, typename Proj, hb_function_sortedness_t Sorted,
380*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterator (Iter))>
381*2d1272b8SAndroid Build Coastguard Worker struct hb_map_iter_t :
382*2d1272b8SAndroid Build Coastguard Worker hb_iter_t<hb_map_iter_t<Iter, Proj, Sorted>,
383*2d1272b8SAndroid Build Coastguard Worker decltype (hb_get (hb_declval (Proj), *hb_declval (Iter)))>
384*2d1272b8SAndroid Build Coastguard Worker {
hb_map_iter_thb_map_iter_t385*2d1272b8SAndroid Build Coastguard Worker hb_map_iter_t (const Iter& it, Proj f_) : it (it), f (f_) {}
386*2d1272b8SAndroid Build Coastguard Worker
387*2d1272b8SAndroid Build Coastguard Worker typedef decltype (hb_get (hb_declval (Proj), *hb_declval (Iter))) __item_t__;
388*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_random_access_iterator = Iter::is_random_access_iterator;
389*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_sorted_iterator =
390*2d1272b8SAndroid Build Coastguard Worker Sorted == hb_function_sortedness_t::SORTED ? true :
391*2d1272b8SAndroid Build Coastguard Worker Sorted == hb_function_sortedness_t::RETAINS_SORTING ? Iter::is_sorted_iterator :
392*2d1272b8SAndroid Build Coastguard Worker false;
__item__hb_map_iter_t393*2d1272b8SAndroid Build Coastguard Worker __item_t__ __item__ () const { return hb_get (f.get (), *it); }
__item_at__hb_map_iter_t394*2d1272b8SAndroid Build Coastguard Worker __item_t__ __item_at__ (unsigned i) const { return hb_get (f.get (), it[i]); }
__more__hb_map_iter_t395*2d1272b8SAndroid Build Coastguard Worker bool __more__ () const { return bool (it); }
__len__hb_map_iter_t396*2d1272b8SAndroid Build Coastguard Worker unsigned __len__ () const { return it.len (); }
__next__hb_map_iter_t397*2d1272b8SAndroid Build Coastguard Worker void __next__ () { ++it; }
__forward__hb_map_iter_t398*2d1272b8SAndroid Build Coastguard Worker void __forward__ (unsigned n) { it += n; }
__prev__hb_map_iter_t399*2d1272b8SAndroid Build Coastguard Worker void __prev__ () { --it; }
__rewind__hb_map_iter_t400*2d1272b8SAndroid Build Coastguard Worker void __rewind__ (unsigned n) { it -= n; }
__end__hb_map_iter_t401*2d1272b8SAndroid Build Coastguard Worker hb_map_iter_t __end__ () const { return hb_map_iter_t (it._end (), f); }
operator !=hb_map_iter_t402*2d1272b8SAndroid Build Coastguard Worker bool operator != (const hb_map_iter_t& o) const
403*2d1272b8SAndroid Build Coastguard Worker { return it != o.it; }
404*2d1272b8SAndroid Build Coastguard Worker
405*2d1272b8SAndroid Build Coastguard Worker private:
406*2d1272b8SAndroid Build Coastguard Worker Iter it;
407*2d1272b8SAndroid Build Coastguard Worker mutable hb_reference_wrapper<Proj> f;
408*2d1272b8SAndroid Build Coastguard Worker };
409*2d1272b8SAndroid Build Coastguard Worker
410*2d1272b8SAndroid Build Coastguard Worker template <typename Proj, hb_function_sortedness_t Sorted>
411*2d1272b8SAndroid Build Coastguard Worker struct hb_map_iter_factory_t
412*2d1272b8SAndroid Build Coastguard Worker {
hb_map_iter_factory_thb_map_iter_factory_t413*2d1272b8SAndroid Build Coastguard Worker hb_map_iter_factory_t (Proj f) : f (f) {}
414*2d1272b8SAndroid Build Coastguard Worker
415*2d1272b8SAndroid Build Coastguard Worker template <typename Iter,
416*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterator (Iter))>
417*2d1272b8SAndroid Build Coastguard Worker hb_map_iter_t<Iter, Proj, Sorted>
operator ()hb_map_iter_factory_t418*2d1272b8SAndroid Build Coastguard Worker operator () (Iter it)
419*2d1272b8SAndroid Build Coastguard Worker { return hb_map_iter_t<Iter, Proj, Sorted> (it, f); }
420*2d1272b8SAndroid Build Coastguard Worker
421*2d1272b8SAndroid Build Coastguard Worker private:
422*2d1272b8SAndroid Build Coastguard Worker Proj f;
423*2d1272b8SAndroid Build Coastguard Worker };
424*2d1272b8SAndroid Build Coastguard Worker struct
425*2d1272b8SAndroid Build Coastguard Worker {
426*2d1272b8SAndroid Build Coastguard Worker template <typename Proj>
427*2d1272b8SAndroid Build Coastguard Worker hb_map_iter_factory_t<Proj, hb_function_sortedness_t::NOT_SORTED>
operator ()__anon3e77a5160408428*2d1272b8SAndroid Build Coastguard Worker operator () (Proj&& f) const
429*2d1272b8SAndroid Build Coastguard Worker { return hb_map_iter_factory_t<Proj, hb_function_sortedness_t::NOT_SORTED> (f); }
430*2d1272b8SAndroid Build Coastguard Worker }
431*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_map);
432*2d1272b8SAndroid Build Coastguard Worker struct
433*2d1272b8SAndroid Build Coastguard Worker {
434*2d1272b8SAndroid Build Coastguard Worker template <typename Proj>
435*2d1272b8SAndroid Build Coastguard Worker hb_map_iter_factory_t<Proj, hb_function_sortedness_t::RETAINS_SORTING>
operator ()__anon3e77a5160508436*2d1272b8SAndroid Build Coastguard Worker operator () (Proj&& f) const
437*2d1272b8SAndroid Build Coastguard Worker { return hb_map_iter_factory_t<Proj, hb_function_sortedness_t::RETAINS_SORTING> (f); }
438*2d1272b8SAndroid Build Coastguard Worker }
439*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_map_retains_sorting);
440*2d1272b8SAndroid Build Coastguard Worker struct
441*2d1272b8SAndroid Build Coastguard Worker {
442*2d1272b8SAndroid Build Coastguard Worker template <typename Proj>
443*2d1272b8SAndroid Build Coastguard Worker hb_map_iter_factory_t<Proj, hb_function_sortedness_t::SORTED>
operator ()__anon3e77a5160608444*2d1272b8SAndroid Build Coastguard Worker operator () (Proj&& f) const
445*2d1272b8SAndroid Build Coastguard Worker { return hb_map_iter_factory_t<Proj, hb_function_sortedness_t::SORTED> (f); }
446*2d1272b8SAndroid Build Coastguard Worker }
447*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_map_sorted);
448*2d1272b8SAndroid Build Coastguard Worker
449*2d1272b8SAndroid Build Coastguard Worker template <typename Iter, typename Pred, typename Proj,
450*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterator (Iter))>
451*2d1272b8SAndroid Build Coastguard Worker struct hb_filter_iter_t :
452*2d1272b8SAndroid Build Coastguard Worker hb_iter_with_fallback_t<hb_filter_iter_t<Iter, Pred, Proj>,
453*2d1272b8SAndroid Build Coastguard Worker typename Iter::item_t>
454*2d1272b8SAndroid Build Coastguard Worker {
hb_filter_iter_thb_filter_iter_t455*2d1272b8SAndroid Build Coastguard Worker hb_filter_iter_t (const Iter& it_, Pred p_, Proj f_) : it (it_), p (p_), f (f_)
456*2d1272b8SAndroid Build Coastguard Worker { while (it && !hb_has (p.get (), hb_get (f.get (), *it))) ++it; }
457*2d1272b8SAndroid Build Coastguard Worker
458*2d1272b8SAndroid Build Coastguard Worker typedef typename Iter::item_t __item_t__;
459*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_sorted_iterator = Iter::is_sorted_iterator;
__item__hb_filter_iter_t460*2d1272b8SAndroid Build Coastguard Worker __item_t__ __item__ () const { return *it; }
__more__hb_filter_iter_t461*2d1272b8SAndroid Build Coastguard Worker bool __more__ () const { return bool (it); }
__next__hb_filter_iter_t462*2d1272b8SAndroid Build Coastguard Worker void __next__ () { do ++it; while (it && !hb_has (p.get (), hb_get (f.get (), *it))); }
__prev__hb_filter_iter_t463*2d1272b8SAndroid Build Coastguard Worker void __prev__ () { do --it; while (it && !hb_has (p.get (), hb_get (f.get (), *it))); }
__end__hb_filter_iter_t464*2d1272b8SAndroid Build Coastguard Worker hb_filter_iter_t __end__ () const { return hb_filter_iter_t (it._end (), p, f); }
operator !=hb_filter_iter_t465*2d1272b8SAndroid Build Coastguard Worker bool operator != (const hb_filter_iter_t& o) const
466*2d1272b8SAndroid Build Coastguard Worker { return it != o.it; }
467*2d1272b8SAndroid Build Coastguard Worker
468*2d1272b8SAndroid Build Coastguard Worker private:
469*2d1272b8SAndroid Build Coastguard Worker Iter it;
470*2d1272b8SAndroid Build Coastguard Worker mutable hb_reference_wrapper<Pred> p;
471*2d1272b8SAndroid Build Coastguard Worker mutable hb_reference_wrapper<Proj> f;
472*2d1272b8SAndroid Build Coastguard Worker };
473*2d1272b8SAndroid Build Coastguard Worker template <typename Pred, typename Proj>
474*2d1272b8SAndroid Build Coastguard Worker struct hb_filter_iter_factory_t
475*2d1272b8SAndroid Build Coastguard Worker {
hb_filter_iter_factory_thb_filter_iter_factory_t476*2d1272b8SAndroid Build Coastguard Worker hb_filter_iter_factory_t (Pred p, Proj f) : p (p), f (f) {}
477*2d1272b8SAndroid Build Coastguard Worker
478*2d1272b8SAndroid Build Coastguard Worker template <typename Iter,
479*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterator (Iter))>
480*2d1272b8SAndroid Build Coastguard Worker hb_filter_iter_t<Iter, Pred, Proj>
operator ()hb_filter_iter_factory_t481*2d1272b8SAndroid Build Coastguard Worker operator () (Iter it)
482*2d1272b8SAndroid Build Coastguard Worker { return hb_filter_iter_t<Iter, Pred, Proj> (it, p, f); }
483*2d1272b8SAndroid Build Coastguard Worker
484*2d1272b8SAndroid Build Coastguard Worker private:
485*2d1272b8SAndroid Build Coastguard Worker Pred p;
486*2d1272b8SAndroid Build Coastguard Worker Proj f;
487*2d1272b8SAndroid Build Coastguard Worker };
488*2d1272b8SAndroid Build Coastguard Worker struct
489*2d1272b8SAndroid Build Coastguard Worker {
490*2d1272b8SAndroid Build Coastguard Worker template <typename Pred = decltype ((hb_identity)),
491*2d1272b8SAndroid Build Coastguard Worker typename Proj = decltype ((hb_identity))>
492*2d1272b8SAndroid Build Coastguard Worker hb_filter_iter_factory_t<Pred, Proj>
operator ()__anon3e77a5160708493*2d1272b8SAndroid Build Coastguard Worker operator () (Pred&& p = hb_identity, Proj&& f = hb_identity) const
494*2d1272b8SAndroid Build Coastguard Worker { return hb_filter_iter_factory_t<Pred, Proj> (p, f); }
495*2d1272b8SAndroid Build Coastguard Worker }
496*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_filter);
497*2d1272b8SAndroid Build Coastguard Worker
498*2d1272b8SAndroid Build Coastguard Worker template <typename Redu, typename InitT>
499*2d1272b8SAndroid Build Coastguard Worker struct hb_reduce_t
500*2d1272b8SAndroid Build Coastguard Worker {
hb_reduce_thb_reduce_t501*2d1272b8SAndroid Build Coastguard Worker hb_reduce_t (Redu r, InitT init_value) : r (r), init_value (init_value) {}
502*2d1272b8SAndroid Build Coastguard Worker
503*2d1272b8SAndroid Build Coastguard Worker template <typename Iter,
504*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterator (Iter)),
505*2d1272b8SAndroid Build Coastguard Worker typename AccuT = hb_decay<decltype (hb_declval (Redu) (hb_declval (InitT), hb_declval (typename Iter::item_t)))>>
506*2d1272b8SAndroid Build Coastguard Worker AccuT
operator ()hb_reduce_t507*2d1272b8SAndroid Build Coastguard Worker operator () (Iter it)
508*2d1272b8SAndroid Build Coastguard Worker {
509*2d1272b8SAndroid Build Coastguard Worker AccuT value = init_value;
510*2d1272b8SAndroid Build Coastguard Worker for (; it; ++it)
511*2d1272b8SAndroid Build Coastguard Worker value = r (value, *it);
512*2d1272b8SAndroid Build Coastguard Worker return value;
513*2d1272b8SAndroid Build Coastguard Worker }
514*2d1272b8SAndroid Build Coastguard Worker
515*2d1272b8SAndroid Build Coastguard Worker private:
516*2d1272b8SAndroid Build Coastguard Worker Redu r;
517*2d1272b8SAndroid Build Coastguard Worker InitT init_value;
518*2d1272b8SAndroid Build Coastguard Worker };
519*2d1272b8SAndroid Build Coastguard Worker struct
520*2d1272b8SAndroid Build Coastguard Worker {
521*2d1272b8SAndroid Build Coastguard Worker template <typename Redu, typename InitT>
522*2d1272b8SAndroid Build Coastguard Worker hb_reduce_t<Redu, InitT>
operator ()__anon3e77a5160808523*2d1272b8SAndroid Build Coastguard Worker operator () (Redu&& r, InitT init_value) const
524*2d1272b8SAndroid Build Coastguard Worker { return hb_reduce_t<Redu, InitT> (r, init_value); }
525*2d1272b8SAndroid Build Coastguard Worker }
526*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_reduce);
527*2d1272b8SAndroid Build Coastguard Worker
528*2d1272b8SAndroid Build Coastguard Worker
529*2d1272b8SAndroid Build Coastguard Worker /* hb_zip() */
530*2d1272b8SAndroid Build Coastguard Worker
531*2d1272b8SAndroid Build Coastguard Worker template <typename A, typename B>
532*2d1272b8SAndroid Build Coastguard Worker struct hb_zip_iter_t :
533*2d1272b8SAndroid Build Coastguard Worker hb_iter_t<hb_zip_iter_t<A, B>,
534*2d1272b8SAndroid Build Coastguard Worker hb_pair_t<typename A::item_t, typename B::item_t>>
535*2d1272b8SAndroid Build Coastguard Worker {
hb_zip_iter_thb_zip_iter_t536*2d1272b8SAndroid Build Coastguard Worker hb_zip_iter_t () {}
hb_zip_iter_thb_zip_iter_t537*2d1272b8SAndroid Build Coastguard Worker hb_zip_iter_t (const A& a, const B& b) : a (a), b (b) {}
538*2d1272b8SAndroid Build Coastguard Worker
539*2d1272b8SAndroid Build Coastguard Worker typedef hb_pair_t<typename A::item_t, typename B::item_t> __item_t__;
540*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_random_access_iterator =
541*2d1272b8SAndroid Build Coastguard Worker A::is_random_access_iterator &&
542*2d1272b8SAndroid Build Coastguard Worker B::is_random_access_iterator;
543*2d1272b8SAndroid Build Coastguard Worker /* Note. The following categorization is only valid if A is strictly sorted,
544*2d1272b8SAndroid Build Coastguard Worker * ie. does NOT have duplicates. Previously I tried to categorize sortedness
545*2d1272b8SAndroid Build Coastguard Worker * more granularly, see commits:
546*2d1272b8SAndroid Build Coastguard Worker *
547*2d1272b8SAndroid Build Coastguard Worker * 513762849a683914fc266a17ddf38f133cccf072
548*2d1272b8SAndroid Build Coastguard Worker * 4d3cf2adb669c345cc43832d11689271995e160a
549*2d1272b8SAndroid Build Coastguard Worker *
550*2d1272b8SAndroid Build Coastguard Worker * However, that was not enough, since hb_sorted_array_t, hb_sorted_vector_t,
551*2d1272b8SAndroid Build Coastguard Worker * SortedArrayOf, etc all needed to be updated to add more variants. At that
552*2d1272b8SAndroid Build Coastguard Worker * point I saw it not worth the effort, and instead we now deem all sorted
553*2d1272b8SAndroid Build Coastguard Worker * collections as essentially strictly-sorted for the purposes of zip.
554*2d1272b8SAndroid Build Coastguard Worker *
555*2d1272b8SAndroid Build Coastguard Worker * The above assumption is not as bad as it sounds. Our "sorted" comes with
556*2d1272b8SAndroid Build Coastguard Worker * no guarantees. It's just a contract, put in place to help you remember,
557*2d1272b8SAndroid Build Coastguard Worker * and think about, whether an iterator you receive is expected to be
558*2d1272b8SAndroid Build Coastguard Worker * sorted or not. As such, it's not perfect by definition, and should not
559*2d1272b8SAndroid Build Coastguard Worker * be treated so. The inaccuracy here just errs in the direction of being
560*2d1272b8SAndroid Build Coastguard Worker * more permissive, so your code compiles instead of erring on the side of
561*2d1272b8SAndroid Build Coastguard Worker * marking your zipped iterator unsorted in which case your code won't
562*2d1272b8SAndroid Build Coastguard Worker * compile.
563*2d1272b8SAndroid Build Coastguard Worker *
564*2d1272b8SAndroid Build Coastguard Worker * This semantical limitation does NOT affect logic in any other place I
565*2d1272b8SAndroid Build Coastguard Worker * know of as of this writing.
566*2d1272b8SAndroid Build Coastguard Worker */
567*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_sorted_iterator = A::is_sorted_iterator;
568*2d1272b8SAndroid Build Coastguard Worker
__item__hb_zip_iter_t569*2d1272b8SAndroid Build Coastguard Worker __item_t__ __item__ () const { return __item_t__ (*a, *b); }
__item_at__hb_zip_iter_t570*2d1272b8SAndroid Build Coastguard Worker __item_t__ __item_at__ (unsigned i) const { return __item_t__ (a[i], b[i]); }
__more__hb_zip_iter_t571*2d1272b8SAndroid Build Coastguard Worker bool __more__ () const { return bool (a) && bool (b); }
__len__hb_zip_iter_t572*2d1272b8SAndroid Build Coastguard Worker unsigned __len__ () const { return hb_min (a.len (), b.len ()); }
__next__hb_zip_iter_t573*2d1272b8SAndroid Build Coastguard Worker void __next__ () { ++a; ++b; }
__forward__hb_zip_iter_t574*2d1272b8SAndroid Build Coastguard Worker void __forward__ (unsigned n) { a += n; b += n; }
__prev__hb_zip_iter_t575*2d1272b8SAndroid Build Coastguard Worker void __prev__ () { --a; --b; }
__rewind__hb_zip_iter_t576*2d1272b8SAndroid Build Coastguard Worker void __rewind__ (unsigned n) { a -= n; b -= n; }
__end__hb_zip_iter_t577*2d1272b8SAndroid Build Coastguard Worker hb_zip_iter_t __end__ () const { return hb_zip_iter_t (a._end (), b._end ()); }
578*2d1272b8SAndroid Build Coastguard Worker /* Note, we should stop if ANY of the iters reaches end. As such two compare
579*2d1272b8SAndroid Build Coastguard Worker * unequal if both items are unequal, NOT if either is unequal. */
operator !=hb_zip_iter_t580*2d1272b8SAndroid Build Coastguard Worker bool operator != (const hb_zip_iter_t& o) const
581*2d1272b8SAndroid Build Coastguard Worker { return a != o.a && b != o.b; }
582*2d1272b8SAndroid Build Coastguard Worker
583*2d1272b8SAndroid Build Coastguard Worker private:
584*2d1272b8SAndroid Build Coastguard Worker A a;
585*2d1272b8SAndroid Build Coastguard Worker B b;
586*2d1272b8SAndroid Build Coastguard Worker };
587*2d1272b8SAndroid Build Coastguard Worker struct
588*2d1272b8SAndroid Build Coastguard Worker { HB_PARTIALIZE(2);
589*2d1272b8SAndroid Build Coastguard Worker template <typename A, typename B,
590*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (A) && hb_is_iterable (B))>
591*2d1272b8SAndroid Build Coastguard Worker hb_zip_iter_t<hb_iter_type<A>, hb_iter_type<B>>
operator ()__anon3e77a5160908592*2d1272b8SAndroid Build Coastguard Worker operator () (A&& a, B&& b) const
593*2d1272b8SAndroid Build Coastguard Worker { return hb_zip_iter_t<hb_iter_type<A>, hb_iter_type<B>> (hb_iter (a), hb_iter (b)); }
594*2d1272b8SAndroid Build Coastguard Worker }
595*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_zip);
596*2d1272b8SAndroid Build Coastguard Worker
597*2d1272b8SAndroid Build Coastguard Worker /* hb_concat() */
598*2d1272b8SAndroid Build Coastguard Worker
599*2d1272b8SAndroid Build Coastguard Worker template <typename A, typename B>
600*2d1272b8SAndroid Build Coastguard Worker struct hb_concat_iter_t :
601*2d1272b8SAndroid Build Coastguard Worker hb_iter_t<hb_concat_iter_t<A, B>, typename A::item_t>
602*2d1272b8SAndroid Build Coastguard Worker {
hb_concat_iter_thb_concat_iter_t603*2d1272b8SAndroid Build Coastguard Worker hb_concat_iter_t () {}
hb_concat_iter_thb_concat_iter_t604*2d1272b8SAndroid Build Coastguard Worker hb_concat_iter_t (A& a, B& b) : a (a), b (b) {}
hb_concat_iter_thb_concat_iter_t605*2d1272b8SAndroid Build Coastguard Worker hb_concat_iter_t (const A& a, const B& b) : a (a), b (b) {}
606*2d1272b8SAndroid Build Coastguard Worker
607*2d1272b8SAndroid Build Coastguard Worker
608*2d1272b8SAndroid Build Coastguard Worker typedef typename A::item_t __item_t__;
609*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_random_access_iterator =
610*2d1272b8SAndroid Build Coastguard Worker A::is_random_access_iterator &&
611*2d1272b8SAndroid Build Coastguard Worker B::is_random_access_iterator;
612*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_sorted_iterator = false;
613*2d1272b8SAndroid Build Coastguard Worker
__item__hb_concat_iter_t614*2d1272b8SAndroid Build Coastguard Worker __item_t__ __item__ () const
615*2d1272b8SAndroid Build Coastguard Worker {
616*2d1272b8SAndroid Build Coastguard Worker if (!a)
617*2d1272b8SAndroid Build Coastguard Worker return *b;
618*2d1272b8SAndroid Build Coastguard Worker return *a;
619*2d1272b8SAndroid Build Coastguard Worker }
620*2d1272b8SAndroid Build Coastguard Worker
__item_at__hb_concat_iter_t621*2d1272b8SAndroid Build Coastguard Worker __item_t__ __item_at__ (unsigned i) const
622*2d1272b8SAndroid Build Coastguard Worker {
623*2d1272b8SAndroid Build Coastguard Worker unsigned a_len = a.len ();
624*2d1272b8SAndroid Build Coastguard Worker if (i < a_len)
625*2d1272b8SAndroid Build Coastguard Worker return a[i];
626*2d1272b8SAndroid Build Coastguard Worker return b[i - a_len];
627*2d1272b8SAndroid Build Coastguard Worker }
628*2d1272b8SAndroid Build Coastguard Worker
__more__hb_concat_iter_t629*2d1272b8SAndroid Build Coastguard Worker bool __more__ () const { return bool (a) || bool (b); }
630*2d1272b8SAndroid Build Coastguard Worker
__len__hb_concat_iter_t631*2d1272b8SAndroid Build Coastguard Worker unsigned __len__ () const { return a.len () + b.len (); }
632*2d1272b8SAndroid Build Coastguard Worker
__next__hb_concat_iter_t633*2d1272b8SAndroid Build Coastguard Worker void __next__ ()
634*2d1272b8SAndroid Build Coastguard Worker {
635*2d1272b8SAndroid Build Coastguard Worker if (a)
636*2d1272b8SAndroid Build Coastguard Worker ++a;
637*2d1272b8SAndroid Build Coastguard Worker else
638*2d1272b8SAndroid Build Coastguard Worker ++b;
639*2d1272b8SAndroid Build Coastguard Worker }
640*2d1272b8SAndroid Build Coastguard Worker
__forward__hb_concat_iter_t641*2d1272b8SAndroid Build Coastguard Worker void __forward__ (unsigned n)
642*2d1272b8SAndroid Build Coastguard Worker {
643*2d1272b8SAndroid Build Coastguard Worker if (!n) return;
644*2d1272b8SAndroid Build Coastguard Worker if (!is_random_access_iterator) {
645*2d1272b8SAndroid Build Coastguard Worker while (n-- && *this) {
646*2d1272b8SAndroid Build Coastguard Worker (*this)++;
647*2d1272b8SAndroid Build Coastguard Worker }
648*2d1272b8SAndroid Build Coastguard Worker return;
649*2d1272b8SAndroid Build Coastguard Worker }
650*2d1272b8SAndroid Build Coastguard Worker
651*2d1272b8SAndroid Build Coastguard Worker unsigned a_len = a.len ();
652*2d1272b8SAndroid Build Coastguard Worker if (n > a_len) {
653*2d1272b8SAndroid Build Coastguard Worker n -= a_len;
654*2d1272b8SAndroid Build Coastguard Worker a.__forward__ (a_len);
655*2d1272b8SAndroid Build Coastguard Worker b.__forward__ (n);
656*2d1272b8SAndroid Build Coastguard Worker } else {
657*2d1272b8SAndroid Build Coastguard Worker a.__forward__ (n);
658*2d1272b8SAndroid Build Coastguard Worker }
659*2d1272b8SAndroid Build Coastguard Worker }
660*2d1272b8SAndroid Build Coastguard Worker
__end__hb_concat_iter_t661*2d1272b8SAndroid Build Coastguard Worker hb_concat_iter_t __end__ () const { return hb_concat_iter_t (a._end (), b._end ()); }
operator !=hb_concat_iter_t662*2d1272b8SAndroid Build Coastguard Worker bool operator != (const hb_concat_iter_t& o) const
663*2d1272b8SAndroid Build Coastguard Worker {
664*2d1272b8SAndroid Build Coastguard Worker return a != o.a
665*2d1272b8SAndroid Build Coastguard Worker || b != o.b;
666*2d1272b8SAndroid Build Coastguard Worker }
667*2d1272b8SAndroid Build Coastguard Worker
668*2d1272b8SAndroid Build Coastguard Worker private:
669*2d1272b8SAndroid Build Coastguard Worker A a;
670*2d1272b8SAndroid Build Coastguard Worker B b;
671*2d1272b8SAndroid Build Coastguard Worker };
672*2d1272b8SAndroid Build Coastguard Worker struct
673*2d1272b8SAndroid Build Coastguard Worker { HB_PARTIALIZE(2);
674*2d1272b8SAndroid Build Coastguard Worker template <typename A, typename B,
675*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (A) && hb_is_iterable (B))>
676*2d1272b8SAndroid Build Coastguard Worker hb_concat_iter_t<hb_iter_type<A>, hb_iter_type<B>>
operator ()__anon3e77a5160a08677*2d1272b8SAndroid Build Coastguard Worker operator () (A&& a, B&& b) const
678*2d1272b8SAndroid Build Coastguard Worker { return hb_concat_iter_t<hb_iter_type<A>, hb_iter_type<B>> (hb_iter (a), hb_iter (b)); }
679*2d1272b8SAndroid Build Coastguard Worker }
680*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_concat);
681*2d1272b8SAndroid Build Coastguard Worker
682*2d1272b8SAndroid Build Coastguard Worker /* hb_apply() */
683*2d1272b8SAndroid Build Coastguard Worker
684*2d1272b8SAndroid Build Coastguard Worker template <typename Appl>
685*2d1272b8SAndroid Build Coastguard Worker struct hb_apply_t
686*2d1272b8SAndroid Build Coastguard Worker {
hb_apply_thb_apply_t687*2d1272b8SAndroid Build Coastguard Worker hb_apply_t (Appl a) : a (a) {}
688*2d1272b8SAndroid Build Coastguard Worker
689*2d1272b8SAndroid Build Coastguard Worker template <typename Iter,
690*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterator (Iter))>
operator ()hb_apply_t691*2d1272b8SAndroid Build Coastguard Worker void operator () (Iter it)
692*2d1272b8SAndroid Build Coastguard Worker {
693*2d1272b8SAndroid Build Coastguard Worker for (; it; ++it)
694*2d1272b8SAndroid Build Coastguard Worker (void) hb_invoke (a, *it);
695*2d1272b8SAndroid Build Coastguard Worker }
696*2d1272b8SAndroid Build Coastguard Worker
697*2d1272b8SAndroid Build Coastguard Worker private:
698*2d1272b8SAndroid Build Coastguard Worker Appl a;
699*2d1272b8SAndroid Build Coastguard Worker };
700*2d1272b8SAndroid Build Coastguard Worker struct
701*2d1272b8SAndroid Build Coastguard Worker {
702*2d1272b8SAndroid Build Coastguard Worker template <typename Appl> hb_apply_t<Appl>
operator ()__anon3e77a5160b08703*2d1272b8SAndroid Build Coastguard Worker operator () (Appl&& a) const
704*2d1272b8SAndroid Build Coastguard Worker { return hb_apply_t<Appl> (a); }
705*2d1272b8SAndroid Build Coastguard Worker
706*2d1272b8SAndroid Build Coastguard Worker template <typename Appl> hb_apply_t<Appl&>
operator ()__anon3e77a5160b08707*2d1272b8SAndroid Build Coastguard Worker operator () (Appl *a) const
708*2d1272b8SAndroid Build Coastguard Worker { return hb_apply_t<Appl&> (*a); }
709*2d1272b8SAndroid Build Coastguard Worker }
710*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_apply);
711*2d1272b8SAndroid Build Coastguard Worker
712*2d1272b8SAndroid Build Coastguard Worker /* hb_range()/hb_iota()/hb_repeat() */
713*2d1272b8SAndroid Build Coastguard Worker
714*2d1272b8SAndroid Build Coastguard Worker template <typename T, typename S>
715*2d1272b8SAndroid Build Coastguard Worker struct hb_range_iter_t :
716*2d1272b8SAndroid Build Coastguard Worker hb_iter_t<hb_range_iter_t<T, S>, T>
717*2d1272b8SAndroid Build Coastguard Worker {
hb_range_iter_thb_range_iter_t718*2d1272b8SAndroid Build Coastguard Worker hb_range_iter_t (T start, T end_, S step) : v (start), end_ (end_for (start, end_, step)), step (step) {}
719*2d1272b8SAndroid Build Coastguard Worker
720*2d1272b8SAndroid Build Coastguard Worker typedef T __item_t__;
721*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_random_access_iterator = true;
722*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_sorted_iterator = true;
__item__hb_range_iter_t723*2d1272b8SAndroid Build Coastguard Worker __item_t__ __item__ () const { return hb_ridentity (v); }
__item_at__hb_range_iter_t724*2d1272b8SAndroid Build Coastguard Worker __item_t__ __item_at__ (unsigned j) const { return v + j * step; }
__more__hb_range_iter_t725*2d1272b8SAndroid Build Coastguard Worker bool __more__ () const { return v != end_; }
__len__hb_range_iter_t726*2d1272b8SAndroid Build Coastguard Worker unsigned __len__ () const { return !step ? UINT_MAX : (end_ - v) / step; }
__next__hb_range_iter_t727*2d1272b8SAndroid Build Coastguard Worker void __next__ () { v += step; }
__forward__hb_range_iter_t728*2d1272b8SAndroid Build Coastguard Worker void __forward__ (unsigned n) { v += n * step; }
__prev__hb_range_iter_t729*2d1272b8SAndroid Build Coastguard Worker void __prev__ () { v -= step; }
__rewind__hb_range_iter_t730*2d1272b8SAndroid Build Coastguard Worker void __rewind__ (unsigned n) { v -= n * step; }
__end__hb_range_iter_t731*2d1272b8SAndroid Build Coastguard Worker hb_range_iter_t __end__ () const { return hb_range_iter_t (end_, end_, step); }
operator !=hb_range_iter_t732*2d1272b8SAndroid Build Coastguard Worker bool operator != (const hb_range_iter_t& o) const
733*2d1272b8SAndroid Build Coastguard Worker { return v != o.v; }
734*2d1272b8SAndroid Build Coastguard Worker
735*2d1272b8SAndroid Build Coastguard Worker private:
end_forhb_range_iter_t736*2d1272b8SAndroid Build Coastguard Worker static inline T end_for (T start, T end_, S step)
737*2d1272b8SAndroid Build Coastguard Worker {
738*2d1272b8SAndroid Build Coastguard Worker if (!step)
739*2d1272b8SAndroid Build Coastguard Worker return end_;
740*2d1272b8SAndroid Build Coastguard Worker auto res = (end_ - start) % step;
741*2d1272b8SAndroid Build Coastguard Worker if (!res)
742*2d1272b8SAndroid Build Coastguard Worker return end_;
743*2d1272b8SAndroid Build Coastguard Worker end_ += step - res;
744*2d1272b8SAndroid Build Coastguard Worker return end_;
745*2d1272b8SAndroid Build Coastguard Worker }
746*2d1272b8SAndroid Build Coastguard Worker
747*2d1272b8SAndroid Build Coastguard Worker private:
748*2d1272b8SAndroid Build Coastguard Worker T v;
749*2d1272b8SAndroid Build Coastguard Worker T end_;
750*2d1272b8SAndroid Build Coastguard Worker S step;
751*2d1272b8SAndroid Build Coastguard Worker };
752*2d1272b8SAndroid Build Coastguard Worker struct
753*2d1272b8SAndroid Build Coastguard Worker {
754*2d1272b8SAndroid Build Coastguard Worker template <typename T = unsigned> hb_range_iter_t<T, unsigned>
operator ()__anon3e77a5160c08755*2d1272b8SAndroid Build Coastguard Worker operator () (T end = (unsigned) -1) const
756*2d1272b8SAndroid Build Coastguard Worker { return hb_range_iter_t<T, unsigned> (0, end, 1u); }
757*2d1272b8SAndroid Build Coastguard Worker
758*2d1272b8SAndroid Build Coastguard Worker template <typename T, typename S = unsigned> hb_range_iter_t<T, S>
operator ()__anon3e77a5160c08759*2d1272b8SAndroid Build Coastguard Worker operator () (T start, T end, S step = 1u) const
760*2d1272b8SAndroid Build Coastguard Worker { return hb_range_iter_t<T, S> (start, end, step); }
761*2d1272b8SAndroid Build Coastguard Worker }
762*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_range);
763*2d1272b8SAndroid Build Coastguard Worker
764*2d1272b8SAndroid Build Coastguard Worker template <typename T, typename S>
765*2d1272b8SAndroid Build Coastguard Worker struct hb_iota_iter_t :
766*2d1272b8SAndroid Build Coastguard Worker hb_iter_with_fallback_t<hb_iota_iter_t<T, S>, T>
767*2d1272b8SAndroid Build Coastguard Worker {
hb_iota_iter_thb_iota_iter_t768*2d1272b8SAndroid Build Coastguard Worker hb_iota_iter_t (T start, S step) : v (start), step (step) {}
769*2d1272b8SAndroid Build Coastguard Worker
770*2d1272b8SAndroid Build Coastguard Worker private:
771*2d1272b8SAndroid Build Coastguard Worker
772*2d1272b8SAndroid Build Coastguard Worker template <typename S2 = S>
773*2d1272b8SAndroid Build Coastguard Worker auto
inchb_iota_iter_t774*2d1272b8SAndroid Build Coastguard Worker inc (hb_type_identity<S2> s, hb_priority<1>)
775*2d1272b8SAndroid Build Coastguard Worker -> hb_void_t<decltype (hb_invoke (std::forward<S2> (s), hb_declval<T&> ()))>
776*2d1272b8SAndroid Build Coastguard Worker { v = hb_invoke (std::forward<S2> (s), v); }
777*2d1272b8SAndroid Build Coastguard Worker
778*2d1272b8SAndroid Build Coastguard Worker void
inchb_iota_iter_t779*2d1272b8SAndroid Build Coastguard Worker inc (S s, hb_priority<0>)
780*2d1272b8SAndroid Build Coastguard Worker { v += s; }
781*2d1272b8SAndroid Build Coastguard Worker
782*2d1272b8SAndroid Build Coastguard Worker public:
783*2d1272b8SAndroid Build Coastguard Worker
784*2d1272b8SAndroid Build Coastguard Worker typedef T __item_t__;
785*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_random_access_iterator = true;
786*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_sorted_iterator = true;
__item__hb_iota_iter_t787*2d1272b8SAndroid Build Coastguard Worker __item_t__ __item__ () const { return hb_ridentity (v); }
__more__hb_iota_iter_t788*2d1272b8SAndroid Build Coastguard Worker bool __more__ () const { return true; }
__len__hb_iota_iter_t789*2d1272b8SAndroid Build Coastguard Worker unsigned __len__ () const { return UINT_MAX; }
__next__hb_iota_iter_t790*2d1272b8SAndroid Build Coastguard Worker void __next__ () { inc (step, hb_prioritize); }
__prev__hb_iota_iter_t791*2d1272b8SAndroid Build Coastguard Worker void __prev__ () { v -= step; }
__end__hb_iota_iter_t792*2d1272b8SAndroid Build Coastguard Worker hb_iota_iter_t __end__ () const { return *this; }
operator !=hb_iota_iter_t793*2d1272b8SAndroid Build Coastguard Worker bool operator != (const hb_iota_iter_t& o) const { return true; }
794*2d1272b8SAndroid Build Coastguard Worker
795*2d1272b8SAndroid Build Coastguard Worker private:
796*2d1272b8SAndroid Build Coastguard Worker T v;
797*2d1272b8SAndroid Build Coastguard Worker S step;
798*2d1272b8SAndroid Build Coastguard Worker };
799*2d1272b8SAndroid Build Coastguard Worker struct
800*2d1272b8SAndroid Build Coastguard Worker {
801*2d1272b8SAndroid Build Coastguard Worker template <typename T = unsigned, typename S = unsigned> hb_iota_iter_t<T, S>
operator ()__anon3e77a5160d08802*2d1272b8SAndroid Build Coastguard Worker operator () (T start = 0u, S step = 1u) const
803*2d1272b8SAndroid Build Coastguard Worker { return hb_iota_iter_t<T, S> (start, step); }
804*2d1272b8SAndroid Build Coastguard Worker }
805*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_iota);
806*2d1272b8SAndroid Build Coastguard Worker
807*2d1272b8SAndroid Build Coastguard Worker template <typename T>
808*2d1272b8SAndroid Build Coastguard Worker struct hb_repeat_iter_t :
809*2d1272b8SAndroid Build Coastguard Worker hb_iter_t<hb_repeat_iter_t<T>, T>
810*2d1272b8SAndroid Build Coastguard Worker {
hb_repeat_iter_thb_repeat_iter_t811*2d1272b8SAndroid Build Coastguard Worker hb_repeat_iter_t (T value) : v (value) {}
812*2d1272b8SAndroid Build Coastguard Worker
813*2d1272b8SAndroid Build Coastguard Worker typedef T __item_t__;
814*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_random_access_iterator = true;
815*2d1272b8SAndroid Build Coastguard Worker static constexpr bool is_sorted_iterator = true;
__item__hb_repeat_iter_t816*2d1272b8SAndroid Build Coastguard Worker __item_t__ __item__ () const { return v; }
__item_at__hb_repeat_iter_t817*2d1272b8SAndroid Build Coastguard Worker __item_t__ __item_at__ (unsigned j) const { return v; }
__more__hb_repeat_iter_t818*2d1272b8SAndroid Build Coastguard Worker bool __more__ () const { return true; }
__len__hb_repeat_iter_t819*2d1272b8SAndroid Build Coastguard Worker unsigned __len__ () const { return UINT_MAX; }
__next__hb_repeat_iter_t820*2d1272b8SAndroid Build Coastguard Worker void __next__ () {}
__forward__hb_repeat_iter_t821*2d1272b8SAndroid Build Coastguard Worker void __forward__ (unsigned) {}
__prev__hb_repeat_iter_t822*2d1272b8SAndroid Build Coastguard Worker void __prev__ () {}
__rewind__hb_repeat_iter_t823*2d1272b8SAndroid Build Coastguard Worker void __rewind__ (unsigned) {}
__end__hb_repeat_iter_t824*2d1272b8SAndroid Build Coastguard Worker hb_repeat_iter_t __end__ () const { return *this; }
operator !=hb_repeat_iter_t825*2d1272b8SAndroid Build Coastguard Worker bool operator != (const hb_repeat_iter_t& o) const { return true; }
826*2d1272b8SAndroid Build Coastguard Worker
827*2d1272b8SAndroid Build Coastguard Worker private:
828*2d1272b8SAndroid Build Coastguard Worker T v;
829*2d1272b8SAndroid Build Coastguard Worker };
830*2d1272b8SAndroid Build Coastguard Worker struct
831*2d1272b8SAndroid Build Coastguard Worker {
832*2d1272b8SAndroid Build Coastguard Worker template <typename T> hb_repeat_iter_t<T>
operator ()__anon3e77a5160e08833*2d1272b8SAndroid Build Coastguard Worker operator () (T value) const
834*2d1272b8SAndroid Build Coastguard Worker { return hb_repeat_iter_t<T> (value); }
835*2d1272b8SAndroid Build Coastguard Worker }
836*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_repeat);
837*2d1272b8SAndroid Build Coastguard Worker
838*2d1272b8SAndroid Build Coastguard Worker /* hb_enumerate()/hb_take() */
839*2d1272b8SAndroid Build Coastguard Worker
840*2d1272b8SAndroid Build Coastguard Worker struct
841*2d1272b8SAndroid Build Coastguard Worker {
842*2d1272b8SAndroid Build Coastguard Worker template <typename Iterable,
843*2d1272b8SAndroid Build Coastguard Worker typename Index = unsigned,
844*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (Iterable))>
845*2d1272b8SAndroid Build Coastguard Worker auto operator () (Iterable&& it, Index start = 0u) const HB_AUTO_RETURN
846*2d1272b8SAndroid Build Coastguard Worker ( hb_zip (hb_iota (start), it) )
847*2d1272b8SAndroid Build Coastguard Worker }
848*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_enumerate);
849*2d1272b8SAndroid Build Coastguard Worker
850*2d1272b8SAndroid Build Coastguard Worker struct
851*2d1272b8SAndroid Build Coastguard Worker { HB_PARTIALIZE(2);
852*2d1272b8SAndroid Build Coastguard Worker template <typename Iterable,
853*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (Iterable))>
operator ()__anon3e77a5161008854*2d1272b8SAndroid Build Coastguard Worker auto operator () (Iterable&& it, unsigned count) const HB_AUTO_RETURN
855*2d1272b8SAndroid Build Coastguard Worker ( hb_zip (hb_range (count), it) | hb_map_retains_sorting (hb_second) )
856*2d1272b8SAndroid Build Coastguard Worker
857*2d1272b8SAndroid Build Coastguard Worker /* Specialization arrays. */
858*2d1272b8SAndroid Build Coastguard Worker
859*2d1272b8SAndroid Build Coastguard Worker template <typename Type> inline hb_array_t<Type>
860*2d1272b8SAndroid Build Coastguard Worker operator () (hb_array_t<Type> array, unsigned count) const
861*2d1272b8SAndroid Build Coastguard Worker { return array.sub_array (0, count); }
862*2d1272b8SAndroid Build Coastguard Worker
863*2d1272b8SAndroid Build Coastguard Worker template <typename Type> inline hb_sorted_array_t<Type>
operator ()__anon3e77a5161008864*2d1272b8SAndroid Build Coastguard Worker operator () (hb_sorted_array_t<Type> array, unsigned count) const
865*2d1272b8SAndroid Build Coastguard Worker { return array.sub_array (0, count); }
866*2d1272b8SAndroid Build Coastguard Worker }
867*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_take);
868*2d1272b8SAndroid Build Coastguard Worker
869*2d1272b8SAndroid Build Coastguard Worker struct
870*2d1272b8SAndroid Build Coastguard Worker { HB_PARTIALIZE(2);
871*2d1272b8SAndroid Build Coastguard Worker template <typename Iter,
872*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterator (Iter))>
873*2d1272b8SAndroid Build Coastguard Worker auto operator () (Iter it, unsigned count) const HB_AUTO_RETURN
874*2d1272b8SAndroid Build Coastguard Worker (
875*2d1272b8SAndroid Build Coastguard Worker + hb_iota (it, hb_add (count))
876*2d1272b8SAndroid Build Coastguard Worker | hb_map (hb_take (count))
877*2d1272b8SAndroid Build Coastguard Worker | hb_take ((hb_len (it) + count - 1) / count)
878*2d1272b8SAndroid Build Coastguard Worker )
879*2d1272b8SAndroid Build Coastguard Worker }
880*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_chop);
881*2d1272b8SAndroid Build Coastguard Worker
882*2d1272b8SAndroid Build Coastguard Worker /* hb_sink() */
883*2d1272b8SAndroid Build Coastguard Worker
884*2d1272b8SAndroid Build Coastguard Worker template <typename Sink>
885*2d1272b8SAndroid Build Coastguard Worker struct hb_sink_t
886*2d1272b8SAndroid Build Coastguard Worker {
hb_sink_thb_sink_t887*2d1272b8SAndroid Build Coastguard Worker hb_sink_t (Sink s) : s (s) {}
888*2d1272b8SAndroid Build Coastguard Worker
889*2d1272b8SAndroid Build Coastguard Worker template <typename Iter,
890*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterator (Iter))>
operator ()hb_sink_t891*2d1272b8SAndroid Build Coastguard Worker void operator () (Iter it)
892*2d1272b8SAndroid Build Coastguard Worker {
893*2d1272b8SAndroid Build Coastguard Worker for (; it; ++it)
894*2d1272b8SAndroid Build Coastguard Worker s << *it;
895*2d1272b8SAndroid Build Coastguard Worker }
896*2d1272b8SAndroid Build Coastguard Worker
897*2d1272b8SAndroid Build Coastguard Worker private:
898*2d1272b8SAndroid Build Coastguard Worker Sink s;
899*2d1272b8SAndroid Build Coastguard Worker };
900*2d1272b8SAndroid Build Coastguard Worker struct
901*2d1272b8SAndroid Build Coastguard Worker {
902*2d1272b8SAndroid Build Coastguard Worker template <typename Sink> hb_sink_t<Sink>
operator ()__anon3e77a5161208903*2d1272b8SAndroid Build Coastguard Worker operator () (Sink&& s) const
904*2d1272b8SAndroid Build Coastguard Worker { return hb_sink_t<Sink> (s); }
905*2d1272b8SAndroid Build Coastguard Worker
906*2d1272b8SAndroid Build Coastguard Worker template <typename Sink> hb_sink_t<Sink&>
operator ()__anon3e77a5161208907*2d1272b8SAndroid Build Coastguard Worker operator () (Sink *s) const
908*2d1272b8SAndroid Build Coastguard Worker { return hb_sink_t<Sink&> (*s); }
909*2d1272b8SAndroid Build Coastguard Worker }
910*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_sink);
911*2d1272b8SAndroid Build Coastguard Worker
912*2d1272b8SAndroid Build Coastguard Worker /* hb-drain: hb_sink to void / blackhole / /dev/null. */
913*2d1272b8SAndroid Build Coastguard Worker
914*2d1272b8SAndroid Build Coastguard Worker struct
915*2d1272b8SAndroid Build Coastguard Worker {
916*2d1272b8SAndroid Build Coastguard Worker template <typename Iter,
917*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterator (Iter))>
operator ()__anon3e77a5161308918*2d1272b8SAndroid Build Coastguard Worker void operator () (Iter it) const
919*2d1272b8SAndroid Build Coastguard Worker {
920*2d1272b8SAndroid Build Coastguard Worker for (; it; ++it)
921*2d1272b8SAndroid Build Coastguard Worker (void) *it;
922*2d1272b8SAndroid Build Coastguard Worker }
923*2d1272b8SAndroid Build Coastguard Worker }
924*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_drain);
925*2d1272b8SAndroid Build Coastguard Worker
926*2d1272b8SAndroid Build Coastguard Worker /* hb_unzip(): unzip and sink to two sinks. */
927*2d1272b8SAndroid Build Coastguard Worker
928*2d1272b8SAndroid Build Coastguard Worker template <typename Sink1, typename Sink2>
929*2d1272b8SAndroid Build Coastguard Worker struct hb_unzip_t
930*2d1272b8SAndroid Build Coastguard Worker {
hb_unzip_thb_unzip_t931*2d1272b8SAndroid Build Coastguard Worker hb_unzip_t (Sink1 s1, Sink2 s2) : s1 (s1), s2 (s2) {}
932*2d1272b8SAndroid Build Coastguard Worker
933*2d1272b8SAndroid Build Coastguard Worker template <typename Iter,
934*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterator (Iter))>
operator ()hb_unzip_t935*2d1272b8SAndroid Build Coastguard Worker void operator () (Iter it)
936*2d1272b8SAndroid Build Coastguard Worker {
937*2d1272b8SAndroid Build Coastguard Worker for (; it; ++it)
938*2d1272b8SAndroid Build Coastguard Worker {
939*2d1272b8SAndroid Build Coastguard Worker const auto &v = *it;
940*2d1272b8SAndroid Build Coastguard Worker s1 << v.first;
941*2d1272b8SAndroid Build Coastguard Worker s2 << v.second;
942*2d1272b8SAndroid Build Coastguard Worker }
943*2d1272b8SAndroid Build Coastguard Worker }
944*2d1272b8SAndroid Build Coastguard Worker
945*2d1272b8SAndroid Build Coastguard Worker private:
946*2d1272b8SAndroid Build Coastguard Worker Sink1 s1;
947*2d1272b8SAndroid Build Coastguard Worker Sink2 s2;
948*2d1272b8SAndroid Build Coastguard Worker };
949*2d1272b8SAndroid Build Coastguard Worker struct
950*2d1272b8SAndroid Build Coastguard Worker {
951*2d1272b8SAndroid Build Coastguard Worker template <typename Sink1, typename Sink2> hb_unzip_t<Sink1, Sink2>
operator ()__anon3e77a5161408952*2d1272b8SAndroid Build Coastguard Worker operator () (Sink1&& s1, Sink2&& s2) const
953*2d1272b8SAndroid Build Coastguard Worker { return hb_unzip_t<Sink1, Sink2> (s1, s2); }
954*2d1272b8SAndroid Build Coastguard Worker
955*2d1272b8SAndroid Build Coastguard Worker template <typename Sink1, typename Sink2> hb_unzip_t<Sink1&, Sink2&>
operator ()__anon3e77a5161408956*2d1272b8SAndroid Build Coastguard Worker operator () (Sink1 *s1, Sink2 *s2) const
957*2d1272b8SAndroid Build Coastguard Worker { return hb_unzip_t<Sink1&, Sink2&> (*s1, *s2); }
958*2d1272b8SAndroid Build Coastguard Worker }
959*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_unzip);
960*2d1272b8SAndroid Build Coastguard Worker
961*2d1272b8SAndroid Build Coastguard Worker
962*2d1272b8SAndroid Build Coastguard Worker /* hb-all, hb-any, hb-none. */
963*2d1272b8SAndroid Build Coastguard Worker
964*2d1272b8SAndroid Build Coastguard Worker struct
965*2d1272b8SAndroid Build Coastguard Worker {
966*2d1272b8SAndroid Build Coastguard Worker template <typename Iterable,
967*2d1272b8SAndroid Build Coastguard Worker typename Pred = decltype ((hb_identity)),
968*2d1272b8SAndroid Build Coastguard Worker typename Proj = decltype ((hb_identity)),
969*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (Iterable))>
operator ()__anon3e77a5161508970*2d1272b8SAndroid Build Coastguard Worker bool operator () (Iterable&& c,
971*2d1272b8SAndroid Build Coastguard Worker Pred&& p = hb_identity,
972*2d1272b8SAndroid Build Coastguard Worker Proj&& f = hb_identity) const
973*2d1272b8SAndroid Build Coastguard Worker {
974*2d1272b8SAndroid Build Coastguard Worker for (auto it = hb_iter (c); it; ++it)
975*2d1272b8SAndroid Build Coastguard Worker if (!hb_match (std::forward<Pred> (p), hb_get (std::forward<Proj> (f), *it)))
976*2d1272b8SAndroid Build Coastguard Worker return false;
977*2d1272b8SAndroid Build Coastguard Worker return true;
978*2d1272b8SAndroid Build Coastguard Worker }
979*2d1272b8SAndroid Build Coastguard Worker }
980*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_all);
981*2d1272b8SAndroid Build Coastguard Worker struct
982*2d1272b8SAndroid Build Coastguard Worker {
983*2d1272b8SAndroid Build Coastguard Worker template <typename Iterable,
984*2d1272b8SAndroid Build Coastguard Worker typename Pred = decltype ((hb_identity)),
985*2d1272b8SAndroid Build Coastguard Worker typename Proj = decltype ((hb_identity)),
986*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (Iterable))>
operator ()__anon3e77a5161608987*2d1272b8SAndroid Build Coastguard Worker bool operator () (Iterable&& c,
988*2d1272b8SAndroid Build Coastguard Worker Pred&& p = hb_identity,
989*2d1272b8SAndroid Build Coastguard Worker Proj&& f = hb_identity) const
990*2d1272b8SAndroid Build Coastguard Worker {
991*2d1272b8SAndroid Build Coastguard Worker for (auto it = hb_iter (c); it; ++it)
992*2d1272b8SAndroid Build Coastguard Worker if (hb_match (std::forward<Pred> (p), hb_get (std::forward<Proj> (f), *it)))
993*2d1272b8SAndroid Build Coastguard Worker return true;
994*2d1272b8SAndroid Build Coastguard Worker return false;
995*2d1272b8SAndroid Build Coastguard Worker }
996*2d1272b8SAndroid Build Coastguard Worker }
997*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_any);
998*2d1272b8SAndroid Build Coastguard Worker struct
999*2d1272b8SAndroid Build Coastguard Worker {
1000*2d1272b8SAndroid Build Coastguard Worker template <typename Iterable,
1001*2d1272b8SAndroid Build Coastguard Worker typename Pred = decltype ((hb_identity)),
1002*2d1272b8SAndroid Build Coastguard Worker typename Proj = decltype ((hb_identity)),
1003*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (Iterable))>
operator ()__anon3e77a51617081004*2d1272b8SAndroid Build Coastguard Worker bool operator () (Iterable&& c,
1005*2d1272b8SAndroid Build Coastguard Worker Pred&& p = hb_identity,
1006*2d1272b8SAndroid Build Coastguard Worker Proj&& f = hb_identity) const
1007*2d1272b8SAndroid Build Coastguard Worker {
1008*2d1272b8SAndroid Build Coastguard Worker for (auto it = hb_iter (c); it; ++it)
1009*2d1272b8SAndroid Build Coastguard Worker if (hb_match (std::forward<Pred> (p), hb_get (std::forward<Proj> (f), *it)))
1010*2d1272b8SAndroid Build Coastguard Worker return false;
1011*2d1272b8SAndroid Build Coastguard Worker return true;
1012*2d1272b8SAndroid Build Coastguard Worker }
1013*2d1272b8SAndroid Build Coastguard Worker }
1014*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_none);
1015*2d1272b8SAndroid Build Coastguard Worker
1016*2d1272b8SAndroid Build Coastguard Worker /*
1017*2d1272b8SAndroid Build Coastguard Worker * Algorithms operating on iterators.
1018*2d1272b8SAndroid Build Coastguard Worker */
1019*2d1272b8SAndroid Build Coastguard Worker
1020*2d1272b8SAndroid Build Coastguard Worker template <typename C, typename V,
1021*2d1272b8SAndroid Build Coastguard Worker hb_requires (hb_is_iterable (C))>
1022*2d1272b8SAndroid Build Coastguard Worker inline void
hb_fill(C && c,const V & v)1023*2d1272b8SAndroid Build Coastguard Worker hb_fill (C&& c, const V &v)
1024*2d1272b8SAndroid Build Coastguard Worker {
1025*2d1272b8SAndroid Build Coastguard Worker for (auto i = hb_iter (c); i; i++)
1026*2d1272b8SAndroid Build Coastguard Worker *i = v;
1027*2d1272b8SAndroid Build Coastguard Worker }
1028*2d1272b8SAndroid Build Coastguard Worker
1029*2d1272b8SAndroid Build Coastguard Worker template <typename S, typename D>
1030*2d1272b8SAndroid Build Coastguard Worker inline void
hb_copy(S && is,D && id)1031*2d1272b8SAndroid Build Coastguard Worker hb_copy (S&& is, D&& id)
1032*2d1272b8SAndroid Build Coastguard Worker {
1033*2d1272b8SAndroid Build Coastguard Worker hb_iter (is) | hb_sink (id);
1034*2d1272b8SAndroid Build Coastguard Worker }
1035*2d1272b8SAndroid Build Coastguard Worker
1036*2d1272b8SAndroid Build Coastguard Worker
1037*2d1272b8SAndroid Build Coastguard Worker #endif /* HB_ITER_HH */
1038