diff options
| author | Tyge Løvset <[email protected]> | 2022-07-06 22:26:53 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-07-06 22:26:53 +0200 |
| commit | b94170eefce899d0b236804681d77fe026956fd9 (patch) | |
| tree | 9d1bad3bdfce085cc8ff8c567943ffd8750aa644 /include/stc/clist.h | |
| parent | 6e91820d7cf632ff30b936c554a0bdf83c9e64b2 (diff) | |
| download | STC-modified-b94170eefce899d0b236804681d77fe026956fd9.tar.gz STC-modified-b94170eefce899d0b236804681d77fe026956fd9.zip | |
Version 3.7. Make sure to check NEWS/Changes in README.md for a few code-breaking API changes.
Diffstat (limited to 'include/stc/clist.h')
| -rw-r--r-- | include/stc/clist.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/include/stc/clist.h b/include/stc/clist.h index 29bf56f3..0fbf01ae 100644 --- a/include/stc/clist.h +++ b/include/stc/clist.h @@ -116,10 +116,12 @@ STC_API _cx_self _cx_memb(_clone)(_cx_self cx); STC_INLINE i_key _cx_memb(_value_clone)(i_key val) { return i_keyclone(val); } STC_INLINE void -_cx_memb(_copy)(_cx_self *self, _cx_self other) { - if (self->last == other.last) return; - _cx_memb(_drop)(self); *self = _cx_memb(_clone)(other); +_cx_memb(_copy)(_cx_self *self, const _cx_self* other) { + if (self->last == other->last) return; + _cx_memb(_drop)(self); *self = _cx_memb(_clone)(*other); } +#endif // !_i_no_clone + #if !defined _i_no_emplace STC_INLINE _cx_value* _cx_memb(_emplace_back)(_cx_self* self, _cx_raw raw) { return _cx_memb(_push_back)(self, i_keyfrom(raw)); } @@ -130,11 +132,10 @@ STC_INLINE _cx_iter _cx_memb(_emplace_at)(_cx_self* self, _cx_iter it, _cx_r STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw) { return _cx_memb(_push_back)(self, i_keyfrom(raw)); } #endif // !_i_no_emplace -#endif // !_i_no_clone STC_INLINE _cx_self _cx_memb(_init)(void) { return c_make(_cx_self){NULL}; } STC_INLINE bool _cx_memb(_reserve)(_cx_self* self, size_t n) { return true; } -STC_INLINE bool _cx_memb(_empty)(_cx_self cx) { return cx.last == NULL; } +STC_INLINE bool _cx_memb(_empty)(const _cx_self* self) { return self->last == NULL; } STC_INLINE void _cx_memb(_clear)(_cx_self* self) { _cx_memb(_drop)(self); } STC_INLINE _cx_value* _cx_memb(_push)(_cx_self* self, i_key value) { return _cx_memb(_push_back)(self, value); } |
