diff options
| author | Tyge Løvset <[email protected]> | 2021-02-20 17:36:17 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-02-20 17:36:17 +0100 |
| commit | 6f2807ac42a42d42aea9b34c89b0cbbd5755fe49 (patch) | |
| tree | 6fddb49da547004315cd8b72a4f26259da689e1c /examples | |
| parent | 4d9378ef420b4787208a742057a60dcf408ef741 (diff) | |
| download | STC-modified-6f2807ac42a42d42aea9b34c89b0cbbd5755fe49.tar.gz STC-modified-6f2807ac42a42d42aea9b34c89b0cbbd5755fe49.zip | |
Renamed push_items to emplace_n
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/advanced.c | 2 | ||||
| -rw-r--r-- | examples/csmap_v1.h | 6 | ||||
| -rw-r--r-- | examples/inits.c | 10 | ||||
| -rw-r--r-- | examples/list.c | 2 | ||||
| -rw-r--r-- | examples/priority.c | 2 |
5 files changed, 11 insertions, 11 deletions
diff --git a/examples/advanced.c b/examples/advanced.c index 8d045b3a..01efc10c 100644 --- a/examples/advanced.c +++ b/examples/advanced.c @@ -42,7 +42,7 @@ using_cmap_keyarg(vk, Viking, int, vikingraw_equals, vikingraw_hash, int main() { cmap_vk vikings = cmap_vk_init(); - c_push_items(&vikings, cmap_vk, { + c_emplace_n(&vikings, cmap_vk, { { {"Einar", "Norway"}, 20}, { {"Olaf", "Denmark"}, 24}, { {"Harald", "Iceland"}, 12}, diff --git a/examples/csmap_v1.h b/examples/csmap_v1.h index 33673b65..4e785a2b 100644 --- a/examples/csmap_v1.h +++ b/examples/csmap_v1.h @@ -231,7 +231,7 @@ int main(void) { return res; \
} \
STC_INLINE C##_##X##_result_t \
- C##_##X##_put(C##_##X* self, RawKey rkey MAP_ONLY_##C(, RawMapped rmapped)) { \
+ C##_##X##_emplace_put(C##_##X* self, RawKey rkey MAP_ONLY_##C(, RawMapped rmapped)) { \
C##_##X##_result_t res = C##_##X##_insert_entry_(self, rkey); \
if (res.second) *KEY_REF_##C(res.first) = keyFromRaw(rkey); \
MAP_ONLY_##C( else mappedDel(&res.first->second); \
@@ -239,9 +239,9 @@ int main(void) { return res; \
} \
STC_INLINE void \
- C##_##X##_push_n(C##_##X* self, const C##_##X##_rawvalue_t arr[], size_t n) { \
+ C##_##X##_emplace_n(C##_##X* self, const C##_##X##_rawvalue_t arr[], size_t n) { \
for (size_t i=0; i<n; ++i) SET_ONLY_##C( C##_##X##_emplace(self, arr[i]); ) \
- MAP_ONLY_##C( C##_##X##_put(self, arr[i].first, arr[i].second); ) \
+ MAP_ONLY_##C( C##_##X##_emplace(self, arr[i].first, arr[i].second); ) \
} \
\
STC_INLINE C##_##X##_result_t \
diff --git a/examples/inits.c b/examples/inits.c index 6e2d1bd9..fd5fdbd3 100644 --- a/examples/inits.c +++ b/examples/inits.c @@ -24,7 +24,7 @@ int main(void) // CVEC FLOAT / PRIORITY QUEUE
cvec_f floats = cvec_f_init();
- c_push_items(&floats, cvec_f, {4.0f, 2.0f, 5.0f, 3.0f, 1.0f});
+ c_emplace_n(&floats, cvec_f, {4.0f, 2.0f, 5.0f, 3.0f, 1.0f});
c_foreach (i, cvec_f, floats) printf("%.1f ", *i.ref);
puts("");
@@ -32,7 +32,7 @@ int main(void) // CVEC PRIORITY QUEUE
cpque_f_make_heap(&floats);
- c_push_items(&floats, cpque_f, {40.0f, 20.0f, 50.0f, 30.0f, 10.0f});
+ c_emplace_n(&floats, cpque_f, {40.0f, 20.0f, 50.0f, 30.0f, 10.0f});
// sorted:
while (! cpque_f_empty(floats)) {
@@ -58,7 +58,7 @@ int main(void) // CMAP CNT
cmap_cnt countries = cmap_cnt_init();
- c_push_items(&countries, cmap_cnt, {
+ c_emplace_n(&countries, cmap_cnt, {
{"Norway", 100},
{"Denmark", 50},
{"Iceland", 10},
@@ -81,7 +81,7 @@ int main(void) // CVEC PAIR
cvec_ip pairs1 = cvec_ip_init();
- c_push_items(&pairs1, cvec_ip, {
+ c_emplace_n(&pairs1, cvec_ip, {
{5, 6},
{3, 4},
{1, 2},
@@ -97,7 +97,7 @@ int main(void) // CLIST PAIR
clist_ip pairs2 = clist_ip_init();
- c_push_items(&pairs2, clist_ip, {
+ c_emplace_n(&pairs2, clist_ip, {
{5, 6},
{3, 4},
{1, 2},
diff --git a/examples/list.c b/examples/list.c index 84ef90f7..47b17f2c 100644 --- a/examples/list.c +++ b/examples/list.c @@ -33,7 +33,7 @@ int main() { puts("");
clist_fx_clear(&list);
- c_push_items(&list, clist_fx, {10, 20, 30, 40, 30, 50});
+ c_emplace_n(&list, clist_fx, {10, 20, 30, 40, 30, 50});
c_foreach (i, clist_fx, list) printf(" %g", *i.ref);
puts("");
diff --git a/examples/priority.c b/examples/priority.c index 548cb06d..4955a6aa 100644 --- a/examples/priority.c +++ b/examples/priority.c @@ -20,7 +20,7 @@ int main() { cpque_i_push(&heap, stc64_uniform(&rng, &dist));
// push some negative numbers too.
- c_push_items(&heap, cpque_i, {-231, -32, -873, -4, -343});
+ c_emplace_n(&heap, cpque_i, {-231, -32, -873, -4, -343});
c_forrange (N)
cpque_i_push(&heap, stc64_uniform(&rng, &dist));
|
