summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cstack.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-04-15 22:08:12 +0200
committerTyge Løvset <[email protected]>2022-04-15 22:08:12 +0200
commitfa261ddd307de9b7bb2965a066fd83b66d8d83a7 (patch)
treef89c186fdaaedb8ab34c223e1a75f4d25db612ab /include/stc/cstack.h
parent99acd2149f3f8996249b3ef82f7490dd098783d7 (diff)
downloadSTC-modified-fa261ddd307de9b7bb2965a066fd83b66d8d83a7.tar.gz
STC-modified-fa261ddd307de9b7bb2965a066fd83b66d8d83a7.zip
Updated README.md docs on template args! Reverted to put() as alias for insert_or_assign() for maps. Reverted/added push_back()/emplace_back()/pop_back() to cstack.
Diffstat (limited to 'include/stc/cstack.h')
-rw-r--r--include/stc/cstack.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/stc/cstack.h b/include/stc/cstack.h
index c5d77ed1..b3f5d5e2 100644
--- a/include/stc/cstack.h
+++ b/include/stc/cstack.h
@@ -87,8 +87,13 @@ STC_INLINE _cx_value* _cx_memb(_push)(_cx_self* self, _cx_value val) {
_cx_value* vp = self->data + self->size++;
*vp = val; return vp;
}
+STC_INLINE _cx_value* _cx_memb(_push_back)(_cx_self* self, _cx_value val)
+ { return _cx_memb(_push)(self, val); }
+
STC_INLINE void _cx_memb(_pop)(_cx_self* self)
{ _cx_value* p = &self->data[--self->size]; i_valdrop(p); }
+STC_INLINE void _cx_memb(_pop_back)(_cx_self* self)
+ { _cx_memb(_pop)(self); }
STC_INLINE const _cx_value* _cx_memb(_at)(const _cx_self* self, size_t idx)
{ assert(idx < self->size); return self->data + idx; }
@@ -97,6 +102,8 @@ STC_INLINE const _cx_value* _cx_memb(_at)(const _cx_self* self, size_t idx)
#if !defined _i_no_emplace
STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw)
{ return _cx_memb(_push)(self, i_valfrom(raw)); }
+STC_INLINE _cx_value* _cx_memb(_emplace_back)(_cx_self* self, _cx_raw raw)
+ { return _cx_memb(_push)(self, i_valfrom(raw)); }
#endif
STC_INLINE _cx_self _cx_memb(_clone)(_cx_self v) {
_cx_self out = {(_cx_value *) c_malloc(v.size*sizeof(_cx_value)), v.size, v.size};