diff options
| author | Tyge Lovset <[email protected]> | 2022-08-17 22:08:15 +0200 |
|---|---|---|
| committer | Tyge Lovset <[email protected]> | 2022-08-18 09:05:24 +0200 |
| commit | c5144785aaac11a30439064decabef62968b00a4 (patch) | |
| tree | e0f17c82ac1c529261d4a414158bae17c380060f /include/stc/cstack.h | |
| parent | a06463c2f0747bc142a9d5b2bf455c64aaf39890 (diff) | |
| download | STC-modified-c5144785aaac11a30439064decabef62968b00a4.tar.gz STC-modified-c5144785aaac11a30439064decabef62968b00a4.zip | |
Some API updates cstr, csview with utf8. Added front()/back() to cstack.
Diffstat (limited to 'include/stc/cstack.h')
| -rw-r--r-- | include/stc/cstack.h | 6 |
1 files changed, 6 insertions, 0 deletions
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)) |
