summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cmap.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-09-21 20:49:22 +0200
committerTyge Løvset <[email protected]>2021-09-21 20:49:22 +0200
commitfbfb57d46e4d042c2c5ae1c5a56dad00660d3e3b (patch)
tree31dea2b7af4298d211b99e50b903be5f39ddebfb /include/stc/cmap.h
parent32a3454eb463f86d7ace7b29c2e1574530499afc (diff)
downloadSTC-modified-fbfb57d46e4d042c2c5ae1c5a56dad00660d3e3b.tar.gz
STC-modified-fbfb57d46e4d042c2c5ae1c5a56dad00660d3e3b.zip
Added copy(self, other) function to all containers. Fixed some docs.
Diffstat (limited to 'include/stc/cmap.h')
-rw-r--r--include/stc/cmap.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/stc/cmap.h b/include/stc/cmap.h
index 096a7045..763764b7 100644
--- a/include/stc/cmap.h
+++ b/include/stc/cmap.h
@@ -272,6 +272,11 @@ STC_DEF void cx_memb(_clear)(Self* self) {
memset(self->_hashx, 0, self->bucket_count);
}
+STC_INLINE void cx_memb(_copy)(Self *self, Self other) {
+ if (self->table == other.table) return;
+ cx_memb(_del)(self); *self = cx_memb(_clone)(other);
+}
+
cx_MAP_ONLY(
STC_DEF cx_result_t
cx_memb(_insert_or_assign)(Self* self, i_key _key, i_val _mapped) {