[iter] Accept pointers in hb_iter()
No idea how to avoid dupicating code. Was hoping hb_deref_pointer() would do it, but looks like a pointer can't bind to a universal reference T&&. Humm.
This commit is contained in:
parent
fc24bb9046
commit
b6f29bf141
|
@ -137,6 +137,11 @@ static const struct
|
|||
operator () (T&& c) const
|
||||
{ return c.iter (); }
|
||||
|
||||
template <typename T>
|
||||
hb_iter_t (T)
|
||||
operator () (T* c) const
|
||||
{ return c->iter (); }
|
||||
|
||||
/* Specialization for C arrays. */
|
||||
|
||||
template <typename Type> inline hb_array_t<Type>
|
||||
|
|
|
@ -106,6 +106,9 @@ main (int argc, char **argv)
|
|||
int dst[20];
|
||||
hb_vector_t<int> v;
|
||||
|
||||
hb_iter (v);
|
||||
hb_iter (&v);
|
||||
|
||||
array_iter_t<const int> s (src); /* Implicit conversion from static array. */
|
||||
array_iter_t<const int> s2 (v); /* Implicit conversion from vector. */
|
||||
array_iter_t<int> t (dst);
|
||||
|
|
Loading…
Reference in New Issue