[meta] Return reference from reference-wrapper

pull/4264/head
Behdad Esfahbod 1 year ago
parent c7493efeaf
commit de729ec105
  1. 6
      src/hb-iter.hh
  2. 8
      src/hb-meta.hh

@ -393,7 +393,7 @@ struct hb_map_iter_t :
private: private:
Iter it; Iter it;
hb_reference_wrapper<Proj> f; mutable hb_reference_wrapper<Proj> f;
}; };
template <typename Proj, hb_function_sortedness_t Sorted> template <typename Proj, hb_function_sortedness_t Sorted>
@ -456,8 +456,8 @@ struct hb_filter_iter_t :
private: private:
Iter it; Iter it;
hb_reference_wrapper<Pred> p; mutable hb_reference_wrapper<Pred> p;
hb_reference_wrapper<Proj> f; mutable hb_reference_wrapper<Proj> f;
}; };
template <typename Pred, typename Proj> template <typename Pred, typename Proj>
struct hb_filter_iter_factory_t struct hb_filter_iter_factory_t

@ -153,8 +153,8 @@ struct hb_reference_wrapper
hb_reference_wrapper (T v) : v (v) {} hb_reference_wrapper (T v) : v (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; }
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; } operator T& () { return v; }
T get () const { return v; } T& get () { return v; }
T v; T v;
}; };
template <typename T> template <typename T>
@ -163,8 +163,8 @@ struct hb_reference_wrapper<T&>
hb_reference_wrapper (T& v) : v (std::addressof (v)) {} hb_reference_wrapper (T& v) : v (std::addressof (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; }
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; } operator T& () { return *v; }
T& get () const { return *v; } T& get () { return *v; }
T* v; T* v;
}; };

Loading…
Cancel
Save