summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cmap.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/cmap.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/cmap.h')
-rw-r--r--include/stc/cmap.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/include/stc/cmap.h b/include/stc/cmap.h
index 707e26f0..340cba87 100644
--- a/include/stc/cmap.h
+++ b/include/stc/cmap.h
@@ -110,13 +110,15 @@ STC_INLINE bool _cx_memb(_contains)(const _cx_self* self, i_keyraw rkey)
{ return self->size && self->_hashx[_cx_memb(_bucket_)(self, &rkey).idx]; }
#ifndef _i_isset
- #if !defined _i_no_clone
- #if !defined _i_no_emplace
+ #if !defined _i_no_clone && !defined _i_no_emplace
STC_API _cx_result _cx_memb(_emplace_or_assign)(_cx_self* self, i_keyraw rkey, i_valraw rmapped);
#endif
- #endif
STC_API _cx_result _cx_memb(_insert_or_assign)(_cx_self* self, i_key _key, i_val _mapped);
+ STC_INLINE _cx_result
+ _cx_memb(_put)(_cx_self* self, i_key _key, i_val _mapped)
+ { return _cx_memb(_insert_or_assign)(self, _key, _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);
@@ -137,6 +139,7 @@ _cx_memb(_value_clone)(_cx_value _val) {
_i_MAP_ONLY( i_valraw m = i_valto((&_val.second)); _val.second = i_valfrom(m); )
return _val;
}
+
#if !defined _i_no_emplace
STC_INLINE _cx_result
_cx_memb(_emplace)(_cx_self* self, i_keyraw rkey _i_MAP_ONLY(, i_valraw rmapped)) {
@@ -170,12 +173,6 @@ _cx_memb(_insert)(_cx_self* self, i_key _key _i_MAP_ONLY(, i_val _mapped)) {
return _res;
}
-STC_INLINE _cx_result
-_cx_memb(_push)(_cx_self* self, i_key _key _i_MAP_ONLY(, i_val _mapped)) {
- return _i_SET_ONLY( _cx_memb(_insert)(self, _key) )
- _i_MAP_ONLY( _cx_memb(_insert_or_assign)(self, _key, _mapped) );
-}
-
STC_INLINE _cx_iter
_cx_memb(_find)(const _cx_self* self, i_keyraw rkey) {
_cx_size idx;