summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cstack.h
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2022-04-20 09:10:50 +0200
committerTyge Lovset <[email protected]>2022-04-20 09:10:50 +0200
commit7254bcc776d4dd5dd2e3e20598858618d5eddcdc (patch)
tree050e9b4522eaaa69578704a0788dcb97170b4079 /include/stc/cstack.h
parenta9c0f215e3e98c165de07d9661595b0dd64cc4fb (diff)
downloadSTC-modified-7254bcc776d4dd5dd2e3e20598858618d5eddcdc.tar.gz
STC-modified-7254bcc776d4dd5dd2e3e20598858618d5eddcdc.zip
Support for cloning containers with carc and cbox.
Disabled emplace methods for containers with carc and cbox.
Diffstat (limited to 'include/stc/cstack.h')
-rw-r--r--include/stc/cstack.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/stc/cstack.h b/include/stc/cstack.h
index b33319c5..7e20a632 100644
--- a/include/stc/cstack.h
+++ b/include/stc/cstack.h
@@ -111,18 +111,18 @@ STC_INLINE _cx_value* _cx_memb(_emplace_back)(_cx_self* self, _cx_raw raw)
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};
- i_valraw r;
for (size_t i = 0; i < v.size; ++v.data)
- r = i_valto(v.data), out.data[i++] = i_valfrom(r);
+ out.data[i++] = i_valclone((*v.data));
return out;
}
+
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 i_val _cx_memb(_value_clone)(_cx_value val)
- { i_valraw r = i_valto((&val)); return i_valfrom(r); }
+ { return i_valclone(val); }
STC_INLINE i_valraw _cx_memb(_value_toraw)(_cx_value* val)
{ return i_valto(val); }