From c5144785aaac11a30439064decabef62968b00a4 Mon Sep 17 00:00:00 2001 From: Tyge Lovset Date: Wed, 17 Aug 2022 22:08:15 +0200 Subject: Some API updates cstr, csview with utf8. Added front()/back() to cstack. --- include/stc/cstack.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/stc/cstack.h') diff --git a/include/stc/cstack.h b/include/stc/cstack.h index e1839d37..9ed2beda 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -120,6 +120,12 @@ STC_INLINE void _cx_memb(_shrink_to_fit)(_cx_self* self) STC_INLINE const _cx_value* _cx_memb(_top)(const _cx_self* self) { return &self->data[self->size - 1]; } +STC_INLINE _cx_value* _cx_memb(_back)(const _cx_self* self) + { return (_cx_value*) &self->data[self->size - 1]; } + +STC_INLINE _cx_value* _cx_memb(_front)(const _cx_self* self) + { return (_cx_value*) &self->data[0]; } + STC_INLINE _cx_value* _cx_memb(_push)(_cx_self* self, _cx_value val) { if (self->size == _cx_memb(_capacity)(self)) if (!_cx_memb(_reserve)(self, self->size*3/2 + 4)) -- cgit v1.2.3