[iter] Add operator << to set / vector

This commit is contained in:
Behdad Esfahbod 2019-01-28 16:39:01 -05:00
parent d438e61042
commit a30e13469e
2 changed files with 6 additions and 0 deletions

View File

@ -373,6 +373,9 @@ struct hb_set_t
/* Predicate. */ /* Predicate. */
bool operator () (hb_codepoint_t k) const { return has (k); } bool operator () (hb_codepoint_t k) const { return has (k); }
/* Sink interface. */
hb_set_t& operator << (hb_codepoint_t v) { add (v); return *this; }
bool intersects (hb_codepoint_t first, hb_codepoint_t last) const bool intersects (hb_codepoint_t first, hb_codepoint_t last) const
{ {
hb_codepoint_t c = first - 1; hb_codepoint_t c = first - 1;

View File

@ -89,6 +89,9 @@ struct hb_vector_t
explicit_operator bool () const { return length; } explicit_operator bool () const { return length; }
/* Sink interface. */
hb_vector_t& operator << (const Type &v) { push (v); return *this; }
hb_array_t< Type> as_array () { return hb_array (arrayZ(), length); } hb_array_t< Type> as_array () { return hb_array (arrayZ(), length); }
hb_array_t<const Type> as_array () const { return hb_array (arrayZ(), length); } hb_array_t<const Type> as_array () const { return hb_array (arrayZ(), length); }