Add methods _front & _last for arrays.
This commit is contained in:
1 parent
5cb8a9ddd0
commit
c821d9ea65
1 file changed
+16
@@ -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) \
|
||||
{ \
|
||||
|
||||
Reference in new issue
Block a user