summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-12-20 19:52:51 +0100
committerTyge Løvset <[email protected]>2021-12-20 19:52:51 +0100
commite38e9164d816bf1ee1f1dcc40f69ac158562fb1a (patch)
tree23bbec187b488730964ab538d401ded9ab319169 /include
parent0c3d711c2541aebe9a44fecb732e096bed14f72c (diff)
downloadSTC-modified-e38e9164d816bf1ee1f1dcc40f69ac158562fb1a.tar.gz
STC-modified-e38e9164d816bf1ee1f1dcc40f69ac158562fb1a.zip
Some small addition to constness in API. Updated docs.
Diffstat (limited to 'include')
-rw-r--r--include/stc/cmap.h2
-rw-r--r--include/stc/csmap.h2
-rw-r--r--include/stc/cstack.h2
-rw-r--r--include/stc/cvec.h9
4 files changed, 8 insertions, 7 deletions
diff --git a/include/stc/cmap.h b/include/stc/cmap.h
index c78c2472..b7529871 100644
--- a/include/stc/cmap.h
+++ b/include/stc/cmap.h
@@ -121,7 +121,7 @@ STC_INLINE bool _cx_memb(_contains)(const _cx_self* self, i_keyraw rkey)
return _cx_memb(_insert_or_assign)(self, key, mapped);
}
- STC_INLINE _cx_mapped*
+ STC_INLINE const _cx_mapped*
_cx_memb(_at)(const _cx_self* self, i_keyraw rkey) {
chash_bucket_t b = _cx_memb(_bucket_)(self, &rkey);
assert(self->_hashx[b.idx]);
diff --git a/include/stc/csmap.h b/include/stc/csmap.h
index 6ba220ab..04dc895d 100644
--- a/include/stc/csmap.h
+++ b/include/stc/csmap.h
@@ -156,7 +156,7 @@ _cx_memb(_value_drop)(_cx_value* val) {
_cx_memb(_put)(_cx_self* self, i_key key, i_val mapped)
{ return _cx_memb(_insert_or_assign)(self, key, mapped); }
- STC_INLINE _cx_mapped*
+ STC_INLINE const _cx_mapped*
_cx_memb(_at)(const _cx_self* self, i_keyraw rkey)
{ _cx_iter it; return &_cx_memb(_find_it)(self, rkey, &it)->second; }
#endif
diff --git a/include/stc/cstack.h b/include/stc/cstack.h
index d43afe29..fa74494d 100644
--- a/include/stc/cstack.h
+++ b/include/stc/cstack.h
@@ -91,7 +91,7 @@ STC_INLINE _cx_value* _cx_memb(_push)(_cx_self* self, _cx_value val) {
*vp = val; return vp;
}
-STC_INLINE _cx_value* _cx_memb(_at)(const _cx_self* self, size_t idx)
+STC_INLINE const _cx_value* _cx_memb(_at)(const _cx_self* self, size_t idx)
{ assert(idx < self->size); return self->data + idx; }
#if !c_option(c_no_clone)
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index 01143d25..92f6afd6 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -104,16 +104,14 @@ STC_INLINE i_val _cx_memb(_value_clone)(_cx_value val)
STC_INLINE i_val _cx_memb(_value_fromraw)(i_valraw raw) { return i_valfrom(raw); }
STC_INLINE _cx_value* _cx_memb(_emplace_back)(_cx_self* self, i_valraw raw)
{ return _cx_memb(_push_back)(self, i_valfrom(raw)); }
+STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, i_valraw raw)
+ { return _cx_memb(_push_back)(self, i_valfrom(raw)); }
STC_INLINE void
_cx_memb(_copy)(_cx_self *self, _cx_self other) {
if (self->data == other.data) return;
_cx_memb(_drop)(self); *self = _cx_memb(_clone)(other);
}
STC_INLINE _cx_iter
-_cx_memb(_emplace)(_cx_self* self, const size_t idx, i_valraw raw) {
- return _cx_memb(_emplace_range_p)(self, self->data + idx, &raw, &raw + 1);
-}
-STC_INLINE _cx_iter
_cx_memb(_emplace_n)(_cx_self* self, const size_t idx, const _cx_rawvalue arr[], const size_t n) {
return _cx_memb(_emplace_range_p)(self, self->data + idx, arr, arr + n);
}
@@ -135,8 +133,11 @@ STC_INLINE void _cx_memb(_swap)(_cx_self* a, _cx_self* b) { c_swap(_cx_s
STC_INLINE _cx_value* _cx_memb(_front)(const _cx_self* self) { return self->data; }
STC_INLINE _cx_value* _cx_memb(_back)(const _cx_self* self)
{ return self->data + cvec_rep_(self)->size - 1; }
+STC_INLINE _cx_value* _cx_memb(_push)(_cx_self* self, i_val value)
+ { return _cx_memb(_push_back)(self, value); }
STC_INLINE void _cx_memb(_pop_back)(_cx_self* self)
{ _cx_value* p = &self->data[--cvec_rep_(self)->size]; i_valdrop(p); }
+STC_INLINE void _cx_memb(_pop)(_cx_self* self) { _cx_memb(_pop_back)(self); }
STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self)
{ return c_make(_cx_iter){self->data}; }
STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)