diff options
| author | Tyge Løvset <[email protected]> | 2022-04-22 12:44:57 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-04-22 12:44:57 +0200 |
| commit | dd5551dec268da39ad1c5c66de014e4621d24748 (patch) | |
| tree | 104de218168bddaee937e92c919e0459d35209fc /include/stc/cmap.h | |
| parent | 8f57f3d331de4cb4aa7d06862c2de3424eb1ba5b (diff) | |
| download | STC-modified-dd5551dec268da39ad1c5c66de014e4621d24748.tar.gz STC-modified-dd5551dec268da39ad1c5c66de014e4621d24748.zip | |
Changed API for c*map_X_push() to take a entry pair (c*map_X_value) argument instead of key + val.
Diffstat (limited to 'include/stc/cmap.h')
| -rw-r--r-- | include/stc/cmap.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/stc/cmap.h b/include/stc/cmap.h index 16041094..6cde2532 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -178,8 +178,10 @@ _cx_memb(_insert)(_cx_self* self, i_key _key _i_MAP_ONLY(, i_val _mapped)) { }
STC_INLINE _cx_result
-_cx_memb(_push)(_cx_self* self, i_key _key _i_MAP_ONLY(, i_val _mapped)) {
- return _cx_memb(_insert)(self, _key _i_MAP_ONLY(, _mapped));
+_cx_memb(_push)(_cx_self* self, _cx_value _val) {
+ _cx_result _res = _cx_memb(_insert_entry_)(self, i_keyto(_i_keyref(&_val)));
+ if (_res.inserted) *_res.ref = _val; else _cx_memb(_value_drop)(&_val);
+ return _res;
}
STC_INLINE _cx_iter
|
