summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-09-13 15:08:29 +0200
committerTyge Løvset <[email protected]>2020-09-13 15:08:29 +0200
commitdbc6eda60967551d3dc83c9152f89bf6a0ac183e (patch)
tree7d4dbadd59991d9fcebb8a033be4a3cb615d120b
parent4b4fdd3fb7ccad613e130b00ee03eef09007737a (diff)
downloadSTC-modified-dbc6eda60967551d3dc83c9152f89bf6a0ac183e.tar.gz
STC-modified-dbc6eda60967551d3dc83c9152f89bf6a0ac183e.zip
added cmap_emplace_n()
-rw-r--r--stc/cmap.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/stc/cmap.h b/stc/cmap.h
index 6447d1a6..b8e53ffe 100644
--- a/stc/cmap.h
+++ b/stc/cmap.h
@@ -237,9 +237,9 @@ typedef struct {size_t idx; uint32_t hx;} cmap_bucket_t, cset_bucket_t;
}) \
\
CMAP_ONLY_##ctype( \
- STC_INLINE ctype##_##X##_result_t \
- ctype##_##X##_insert(ctype##_##X* self, cmap_##X##_input_t pair) { \
- return ctype##_##X##_emplace(self, pair.key, pair.value); \
+ STC_INLINE void \
+ ctype##_##X##_emplace_n(ctype##_##X* self, const cmap_##X##_input_t pairs[], size_t n) { \
+ for (size_t i=0; i<n; ++i) ctype##_##X##_emplace(self, pairs[i].key, pairs[i].value); \
} \
STC_INLINE ctype##_##X##_result_t \
ctype##_##X##_insert_or_assign(ctype##_##X* self, RawKey rawKey, RawValue rawValue) { \
@@ -315,8 +315,8 @@ typedef struct {size_t idx; uint32_t hx;} cmap_bucket_t, cset_bucket_t;
return h; \
} \
STC_API void \
- ctype##_##X##_push_n(ctype##_##X* self, const ctype##_##X##_input_t in[], size_t size) { \
- for (size_t i=0; i<size; ++i) ctype##_##X##_put(self, CMAP_ARGS_##ctype(in[i].key, in[i].value)); \
+ ctype##_##X##_push_n(ctype##_##X* self, const ctype##_##X##_input_t in[], size_t n) { \
+ for (size_t i=0; i<n; ++i) ctype##_##X##_put(self, CMAP_ARGS_##ctype(in[i].key, in[i].value)); \
} \
\
STC_INLINE void ctype##_##X##_wipe_(ctype##_##X* self) { \