From de729ec10566e8dd8bf1f22d9bbf73c2b9f54aeb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 3 Jun 2023 15:48:54 -0600 Subject: [PATCH] [meta] Return reference from reference-wrapper --- src/hb-iter.hh | 6 +++--- src/hb-meta.hh | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hb-iter.hh b/src/hb-iter.hh index b123b2f27..98d65a895 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -393,7 +393,7 @@ struct hb_map_iter_t : private: Iter it; - hb_reference_wrapper f; + mutable hb_reference_wrapper f; }; template @@ -456,8 +456,8 @@ struct hb_filter_iter_t : private: Iter it; - hb_reference_wrapper p; - hb_reference_wrapper f; + mutable hb_reference_wrapper p; + mutable hb_reference_wrapper f; }; template struct hb_filter_iter_factory_t diff --git a/src/hb-meta.hh b/src/hb-meta.hh index 31aa7fa6f..52ff4a841 100644 --- a/src/hb-meta.hh +++ b/src/hb-meta.hh @@ -153,8 +153,8 @@ struct hb_reference_wrapper 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; } - operator T () const { return v; } - T get () const { return v; } + operator T& () { return v; } + T& get () { return v; } T v; }; template @@ -163,8 +163,8 @@ struct hb_reference_wrapper 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; } - operator T& () const { return *v; } - T& get () const { return *v; } + operator T& () { return *v; } + T& get () { return *v; } T* v; };