Add methods _front & _last for arrays.

This commit is contained in:
Patrick Pelissier committed 2018-06-23 11:05:29 +02:00
1 parent 5cb8a9ddd0
commit c821d9ea65
1 file changed
+16
+16
View File
@@ -545,6 +545,22 @@
return M_CONST_CAST(type, &v->ptr[i]); \
} \
\
static inline const type * \
M_C(name, _front)(const array_t v) \
{ \
ARRAYI_CONTRACT(v); \
assert (v->size > 0); \
return M_C(name, _cget)(v, 0); \
} \
\
static inline const type * \
M_C(name, _last)(const array_t v) \
{ \
ARRAYI_CONTRACT(v); \
assert (v->size > 0); \
return M_C(name, _cget)(v, v->size-1); \
} \
\
static inline void \
M_C(name, _it)(array_it_t it, const array_t v) \
{ \