diff options
| author | Tyge Løvset <[email protected]> | 2021-09-21 20:49:22 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-09-21 20:49:22 +0200 |
| commit | fbfb57d46e4d042c2c5ae1c5a56dad00660d3e3b (patch) | |
| tree | 31dea2b7af4298d211b99e50b903be5f39ddebfb /include/stc/cvec.h | |
| parent | 32a3454eb463f86d7ace7b29c2e1574530499afc (diff) | |
| download | STC-modified-fbfb57d46e4d042c2c5ae1c5a56dad00660d3e3b.tar.gz STC-modified-fbfb57d46e4d042c2c5ae1c5a56dad00660d3e3b.zip | |
Added copy(self, other) function to all containers. Fixed some docs.
Diffstat (limited to 'include/stc/cvec.h')
| -rw-r--r-- | include/stc/cvec.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/stc/cvec.h b/include/stc/cvec.h index 03e04290..3dc7b4c1 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -137,6 +137,12 @@ cx_memb(_shrink_to_fit)(Self *self) { cx_memb(_del)(self); *self = cx;
}
+STC_INLINE void
+cx_memb(_copy)(Self *self, Self other) {
+ if (self->data == other.data) return;
+ cx_memb(_del)(self); *self = cx_memb(_clone)(other);
+}
+
STC_INLINE cx_iter_t
cx_memb(_insert)(Self* self, size_t idx, i_val value) {
return cx_memb(_insert_range_p)(self, self->data + idx, &value, &value + 1, false);
|
