diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 549b78865..63a178ae3 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -331,6 +331,7 @@ struct hb_map_iter_t : void __forward__ (unsigned n) { it += n; } void __prev__ () { --it; } void __rewind__ (unsigned n) { it -= n; } + hb_map_iter_t __end__ () const { return hb_map_iter_t (it.end (), f); } bool operator != (const hb_map_iter_t& o) const { return it != o.it || f != o.f; } @@ -376,6 +377,7 @@ struct hb_filter_iter_t : bool __more__ () const { return bool (it); } void __next__ () { do ++it; while (it && !hb_has (p.get (), hb_get (f.get (), *it))); } void __prev__ () { --it; } + hb_filter_iter_t __end__ () const { return hb_filter_iter_t (it.end (), p, f); } bool operator != (const hb_filter_iter_t& o) const { return it != o.it || p != o.p || f != o.f; } diff --git a/src/hb-meta.hh b/src/hb-meta.hh index fc64e9707..b65a09efe 100644 --- a/src/hb-meta.hh +++ b/src/hb-meta.hh @@ -145,17 +145,19 @@ struct hb_reference_wrapper hb_reference_wrapper (const hb_reference_wrapper& o) : v (o.v) {} bool operator == (const hb_reference_wrapper& o) const { return v == o.v; } bool operator != (const hb_reference_wrapper& o) const { return v != o.v; } + operator T () const { return v; } T get () const { return v; } T v; }; template struct hb_reference_wrapper { - hb_reference_wrapper (T& v) : v (&v) {} + hb_reference_wrapper (T& v) : v (hb_addressof (v)) {} hb_reference_wrapper (const hb_reference_wrapper& o) : v (o.v) {} bool operator == (const hb_reference_wrapper& o) const { return v == o.v; } bool operator != (const hb_reference_wrapper& o) const { return v != o.v; } - T* get () const { return v; } + operator T& () const { return *v; } + T& get () const { return *v; } T* v; };