提交 72dd5e34 编写于 作者: B Behdad Esfahbod

[iter] Make hb_iter() into function-object

上级 98be7bd7
......@@ -124,16 +124,26 @@ struct hb_iter_t
/* TODO Change to function-object. */
template <typename T>
inline hb_iter_t (T)
hb_iter (const T& c) { return c.iter (); }
/* Specialization for C arrays. */
template <typename> struct hb_array_t;
template <typename Type> inline hb_array_t<Type>
hb_iter (Type *array, unsigned int length) { return hb_array_t<Type> (array, length); }
template <typename Type, unsigned int length> hb_array_t<Type>
hb_iter (Type (&array)[length]) { return hb_iter (array, length); }
static const struct
{
template <typename T>
hb_iter_t (T)
operator () (const T& c) const
{ return c.iter (); }
/* Specialization for C arrays. */
template <typename Type> inline hb_array_t<Type>
operator () (Type *array, unsigned int length) const
{ return hb_array_t<Type> (array, length); }
template <typename Type, unsigned int length> hb_array_t<Type>
operator () (Type (&array)[length]) const
{ return hb_array_t<Type> (array, length); }
} hb_iter HB_UNUSED;
/* Mixin to fill in what the subclass doesn't provide. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册