提交 13a8786c 编写于 作者: B Behdad Esfahbod

Add (unused) hb_array_t<>

上级 bccf3e18
......@@ -29,6 +29,8 @@
#include "hb.hh"
#include "hb-null.hh"
/* Void! For when we need a expression-type of void. */
typedef const struct _hb_void_t *hb_void_t;
......@@ -507,6 +509,24 @@ struct hb_auto_t : Type
void fini (void) {}
};
template <typename T>
struct hb_array_t
{
inline hb_array_t (void) : arrayZ (nullptr), len (0) {}
inline hb_array_t (const T *array_, unsigned int len_) : arrayZ (array_), len (len_) {}
inline const T& operator [] (unsigned int i) const
{
if (unlikely (i >= len)) return Null(T);
return arrayZ[i];
}
inline void free (void) { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; }
const T *arrayZ;
unsigned int len;
};
struct hb_bytes_t
{
inline hb_bytes_t (void) : bytes (nullptr), len (0) {}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册