[array] Add constructor from fixed-size array

This commit is contained in:
Behdad Esfahbod 2018-12-17 00:02:42 -05:00
parent a4354d2fd3
commit 68d4a5eee0
2 changed files with 3 additions and 2 deletions

View File

@ -46,6 +46,7 @@ struct hb_array_t
hb_array_t (const hb_array_t &o) : arrayZ (o.arrayZ), len (o.len) {}
hb_array_t (hb_array_t<const Type> o) : arrayZ (o.arrayZ), len (o.len) {}
hb_array_t (Type *array_, unsigned int len_) : arrayZ (array_), len (len_) {}
template <unsigned int len_> hb_array_t (Type (&array_)[len_]) : arrayZ (array_), len (len_) {}
/*
* Operators.

View File

@ -54,7 +54,7 @@ struct Iter;
template <typename T>
struct Iter
{
explicit inline Iter (const T &c);
Iter (const T &c);
};
#endif
@ -68,7 +68,7 @@ struct Iter<T *>
Iter (T *array_, int length_) :
array (array_), length (MAX (length_, 0)) {}
template <unsigned int length_>
explicit inline Iter (T (&array_)[length_]) :
Iter (T (&array_)[length_]) :
array (array_), length (length_) {}
/* Emptiness. */