diff --git a/src/hb-serialize.hh b/src/hb-serialize.hh index 828d23992..407a330a0 100644 --- a/src/hb-serialize.hh +++ b/src/hb-serialize.hh @@ -151,7 +151,7 @@ struct hb_serialize_context_t obj.head = tail; obj.tail = tail + len; - packed.push (obj); + packed.push (hb_move (obj)); /* TODO Handle error. */ if (unlikely (packed.in_error ())) diff --git a/src/hb-vector.hh b/src/hb-vector.hh index 5b1a83c56..879340506 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -109,7 +109,7 @@ struct hb_vector_t /* Sink interface. */ template - hb_vector_t& operator << (const T& v) { push (v); return *this; } + hb_vector_t& operator << (T&& v) { push (hb_forward (v)); return *this; } hb_array_t< Type> as_array () { return hb_array (arrayZ(), length); } hb_array_t as_array () const { return hb_array (arrayZ(), length); } @@ -149,10 +149,10 @@ struct hb_vector_t return &arrayZ()[length - 1]; } template - Type *push (const T& v) + Type *push (T&& v) { Type *p = push (); - *p = v; + *p = hb_forward (v); return p; } @@ -209,7 +209,7 @@ struct hb_vector_t Type pop () { if (!length) return Null(Type); - return arrayZ()[--length]; + return hb_move (arrayZ()[--length]); /* Does this move actually work? */ } void remove (unsigned int i)