Simplify propagate_error()

This commit is contained in:
Behdad Esfahbod 2019-04-22 15:16:35 -04:00
parent ecac94ca76
commit 9bab398462
1 changed files with 6 additions and 6 deletions

View File

@ -120,12 +120,12 @@ struct hb_serialize_context_t
this->packed.push (nullptr);
}
bool propagate_error (bool e)
{ return this->successful = this->successful && e; }
template <typename T> bool propagate_error (const T &obj)
{ return this->successful = this->successful && !obj.in_error (); }
template <typename T> bool propagate_error (const T *obj)
{ return this->successful = this->successful && !obj->in_error (); }
bool propagate_error (bool success)
{ return this->successful = this->successful && success; }
template <typename T> bool propagate_error (T &&obj)
{ return propagate_error (!hb_deref_pointer (obj).in_error ()); }
template <typename T1, typename T2> bool propagate_error (T1 &&o1, T2 &&o2)
{ return propagate_error (o1) && propagate_error (o2); }
template <typename T1, typename T2, typename T3>