[array] Add constructor taking std::nullptr_t

Not all impls implement nullptr_t in a way that would automatically
convert to what we were accepting.

In file included from ../src/test-map.cc:27:
../src/hb-map.hh:44:22: error: no viable conversion from 'nullptr_t' to 'const hb_array_t<const char>'
  static constexpr K INVALID_KEY   = kINVALID;
                     ^               ~~~~~~~~
This commit is contained in:
Behdad Esfahbod 2021-11-19 12:11:41 -07:00
parent e456922a76
commit 1da7423ed9
1 changed files with 2 additions and 0 deletions

View File

@ -56,6 +56,7 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
hb_array_t& operator= (const hb_array_t&) = default;
hb_array_t& operator= (hb_array_t&&) = default;
hb_array_t (std::nullptr_t) : hb_array_t () {}
hb_array_t (Type *array_, unsigned int length_) : arrayZ (array_), length (length_) {}
template <unsigned int length_>
hb_array_t (Type (&array_)[length_]) : hb_array_t (array_, length_) {}
@ -313,6 +314,7 @@ struct hb_sorted_array_t :
hb_sorted_array_t& operator= (const hb_sorted_array_t&) = default;
hb_sorted_array_t& operator= (hb_sorted_array_t&&) = default;
hb_sorted_array_t (std::nullptr_t) : hb_sorted_array_t () {}
hb_sorted_array_t (Type *array_, unsigned int length_) : hb_array_t<Type> (array_, length_) {}
template <unsigned int length_>
hb_sorted_array_t (Type (&array_)[length_]) : hb_array_t<Type> (array_) {}