From 9ad1de563150b5819a17ceb07e5bb1a83f39f2b4 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sun, 21 Feb 2021 19:44:29 +0100 Subject: Renamed emplace_put() to emplace_or_assign(). May add put() as alias to insert_or_assign(). --- README.md | 2 +- benchmarks/cmap_benchmark2.cpp | 4 ++-- benchmarks/cmap_benchmark3.cpp | 2 +- benchmarks/csmap_benchmark2.cpp | 6 +++--- docs/ccommon_api.md | 6 +++--- docs/cdeq_api.md | 2 +- docs/cmap_api.md | 6 +++--- docs/cpque_api.md | 2 +- docs/cptr_api.md | 12 ++++++------ docs/csmap_api.md | 6 +++--- docs/cvec_api.md | 4 ++-- examples/advanced.c | 4 ++-- examples/csmap_v1.h | 2 +- examples/demos.c | 6 +++--- examples/inits.c | 10 +++++----- examples/list.c | 2 +- examples/mapmap.c | 2 +- examples/phonebook.c | 2 +- examples/priority.c | 2 +- examples/stc_astar.c | 4 ++-- stc/ccommon.h | 4 ++-- stc/cmap.h | 4 ++-- stc/csmap.h | 2 +- stc/cvec.h | 2 +- 24 files changed, 49 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index f23aa394..4ffc4b76 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,7 @@ conditionally inserted. The **emplace()** and **put()** methods constructs cstr- when required: ```c cmap_str_emplace(&map, "Hello", "world"); // no cstr is constructed if "Hello" is already in the map. -cmap_str_emplace_put(&map, "Hello", "world!!"); // similar, but cstr_from("world!!") call is always made in put. +cmap_str_emplace_or_assign(&map, "Hello", "world!!"); // similar, but cstr_from("world!!") call is always made in put. it = cmap_str_find(&map, "Hello"); // no cstr constructed for lookup, although keys are cstr-type. ``` In the **cmap_str_insert()** example at the top of this section, both the key and mapped value are first constructed, diff --git a/benchmarks/cmap_benchmark2.cpp b/benchmarks/cmap_benchmark2.cpp index 2678ac4d..158775d5 100644 --- a/benchmarks/cmap_benchmark2.cpp +++ b/benchmarks/cmap_benchmark2.cpp @@ -236,7 +236,7 @@ static void ins_and_access_cmap_s(picobench::state& s) picobench::scope scope(s); c_forrange (s.iterations()) { randomize(str.str, cstr_size(str)); - cmap_str_emplace_put(&map, str.str, str.str); + cmap_str_emplace_or_assign(&map, str.str, str.str); randomize(str.str, cstr_size(str)); cmap_str_iter_t it = cmap_str_find(&map, str.str); if (it.ref) { @@ -303,7 +303,7 @@ static void iterate_cmap_x(picobench::state& s) // measure insert then iterate whole map c_forrange (n, s.iterations()) { - cmap_x_emplace_put(&map, stc64_random(), n); + cmap_x_emplace_or_assign(&map, stc64_random(), n); if (!(n & K)) c_foreach (i, cmap_x, map) result += i.ref->second; } diff --git a/benchmarks/cmap_benchmark3.cpp b/benchmarks/cmap_benchmark3.cpp index fa7edabd..13905a3f 100644 --- a/benchmarks/cmap_benchmark3.cpp +++ b/benchmarks/cmap_benchmark3.cpp @@ -35,7 +35,7 @@ stc64_t rng; #define CMAP_SETUP(X, Key, Value) cmap_##X map = cmap_##X##_init() \ ; cmap_##X##_set_load_factors(&map, 0.0, max_load_factor) -#define CMAP_PUT(X, key, val) cmap_##X##_emplace_put(&map, key, val).first->second +#define CMAP_PUT(X, key, val) cmap_##X##_emplace_or_assign(&map, key, val).first->second #define CMAP_EMPLACE(X, key, val) cmap_##X##_emplace(&map, key, val).first->second #define CMAP_ERASE(X, key) cmap_##X##_erase(&map, key) #define CMAP_FIND(X, key) (cmap_##X##_find(map, key) != NULL) diff --git a/benchmarks/csmap_benchmark2.cpp b/benchmarks/csmap_benchmark2.cpp index 08953868..02d25c51 100644 --- a/benchmarks/csmap_benchmark2.cpp +++ b/benchmarks/csmap_benchmark2.cpp @@ -127,7 +127,7 @@ static void ins_and_erase_csmap_i(picobench::state& s) csmap_i_clear(&map); stc64_srandom(seed); c_forrange (i, s.iterations()) - csmap_i_emplace_put(&map, stc64_random() & mask, i); + csmap_i_emplace_or_assign(&map, stc64_random() & mask, i); stc64_srandom(seed); c_forrange (s.iterations()) @@ -222,7 +222,7 @@ static void ins_and_access_csmap_s(picobench::state& s) picobench::scope scope(s); c_forrange (s.iterations()) { randomize(str.str, cstr_size(str)); - csmap_s_emplace_put(&map, str.str, cstr_clone(str)); + csmap_s_emplace_or_assign(&map, str.str, cstr_clone(str)); randomize(str.str, cstr_size(str)); csmap_s_iter_t it = csmap_s_find(&map, str.str); if (it.ref) { @@ -282,7 +282,7 @@ static void iterate_csmap_x(picobench::state& s) // measure insert then iterate whole map c_forrange (n, s.iterations()) { - csmap_x_emplace_put(&map, stc64_random(), n); + csmap_x_emplace_or_assign(&map, stc64_random(), n); if (!(n & K)) c_foreach (i, csmap_x, map) result += i.ref->second; } diff --git a/docs/ccommon_api.md b/docs/ccommon_api.md index 2302c884..ed8ae3d4 100644 --- a/docs/ccommon_api.md +++ b/docs/ccommon_api.md @@ -2,11 +2,11 @@ The following handy macros are completely safe to use, i.e. they have no side-effects. -### c_init, c_emplace_n -**c_init** declares and initializes any container with an array of elements. **c_emplace_n** adds elements to any existing container: +### c_init, c_emplace_items +**c_init** declares and initializes any container with an array of elements. **c_emplace_items** adds elements to any existing container: ```c c_init (cvec_i, vec, {1, 2, 3}); -c_emplace_n(&vec, cvec_i, {4, 5, 6}); +c_emplace_items(&vec, cvec_i, {4, 5, 6}); ``` ### c_forrange diff --git a/docs/cdeq_api.md b/docs/cdeq_api.md index d84b9fdf..8fe8b4a8 100644 --- a/docs/cdeq_api.md +++ b/docs/cdeq_api.md @@ -117,7 +117,7 @@ int main() { printf(" %d", *i.ref); puts(""); - c_emplace_n(&q, cdeq_i, {1, 4, 5, 22, 33, 2}); + c_emplace_items(&q, cdeq_i, {1, 4, 5, 22, 33, 2}); c_foreach (i, cdeq_i, q) printf(" %d", *i.ref); puts(""); diff --git a/docs/cmap_api.md b/docs/cmap_api.md index 0114a365..b81a9ea3 100644 --- a/docs/cmap_api.md +++ b/docs/cmap_api.md @@ -66,7 +66,7 @@ bool cmap_X_contains(const cmap_X* self, RawKey rkey); cmap_X_result_t cmap_X_insert(cmap_X* self, Key key, Mapped mapped); // no change if key in map cmap_X_result_t cmap_X_insert_or_assign(cmap_X* self, Key key, Mapped mapped); // always update mapped cmap_X_result_t cmap_X_emplace(cmap_X* self, RawKey rkey, RawMapped rmapped); // no change if rkey in map -cmap_X_result_t cmap_X_emplace_put(cmap_X* self, RawKey rkey, RawMapped rmapped); // always update rmapped +cmap_X_result_t cmap_X_emplace_or_assign(cmap_X* self, RawKey rkey, RawMapped rmapped); // always update rmapped void cmap_X_emplace_n(cmap_X* self, const cmap_X_rawvalue_t arr[], size_t size); cmap_X_mapped_t* cmap_X_at(const cmap_X* self, RawKey rkey); // rkey must be in map. @@ -170,7 +170,7 @@ int main() {110, "Blue"}, }); /* put replaces existing mapped value: */ - cmap_id_emplace_put(&idnames, 110, "White"); + cmap_id_emplace_or_assign(&idnames, 110, "White"); /* put a constructed mapped value into map: */ cmap_id_insert_or_assign(&idnames, 120, cstr_from_fmt("#%08x", col)); /* emplace inserts only when key does not exist: */ @@ -304,7 +304,7 @@ int main() { {"Olaf", "Denmark"}, 24 }, { {"Harald", "Iceland"}, 12 }, }); - cmap_vk_emplace_put(&vikings, (VikingRaw){"Bjorn", "Sweden"}, 10); + cmap_vk_emplace_or_assign(&vikings, (VikingRaw){"Bjorn", "Sweden"}, 10); VikingRaw lookup = {"Einar", "Norway"}; diff --git a/docs/cpque_api.md b/docs/cpque_api.md index d2a5d8e0..794cd77d 100644 --- a/docs/cpque_api.md +++ b/docs/cpque_api.md @@ -76,7 +76,7 @@ int main() // Push ten million random numbers to priority queue, plus some negative ones. c_forrange (N) cpque_i_push(&heap, stc64_uniform(&rng, &dist)); - c_emplace_n(&heap, cpque_i, {-231, -32, -873, -4, -343}); + c_emplace_items(&heap, cpque_i, {-231, -32, -873, -4, -343}); // Extract and display the fifty smallest. c_forrange (50) { diff --git a/docs/cptr_api.md b/docs/cptr_api.md index baf31177..6df05909 100644 --- a/docs/cptr_api.md +++ b/docs/cptr_api.md @@ -9,13 +9,13 @@ The pointed-to elements are automatically destructed and deleted when the contai ## Declaration ```c -using_cptr(X, Value, valueCompare=c_default_compare, - valueDestroy=c_default_del, - valueClone=c_default_fromraw) +using_cptr(X, Value); +using_cptr(X, Value, valueCompare); +using_cptr(X, Value, valueCompare, valueDestroy); -using_csptr(X, Value, valueCompare=c_default_compare, - valueDestroy=c_default_del, - valueClone=ignored) +using_csptr(X, Value); +using_csptr(X, Value, valueCompare); +using_csptr(X, Value, valueCompare, valueDestroy); ``` The macro `using_cptr()` must be instantiated in the global scope. `X` is a type tag name and will affect the names of all cptr types and methods. E.g. declaring `using_cptr(my, cvec_my);`, diff --git a/docs/csmap_api.md b/docs/csmap_api.md index 402ac2bf..b8f12267 100644 --- a/docs/csmap_api.md +++ b/docs/csmap_api.md @@ -53,13 +53,13 @@ bool csmap_X_empty(csmap_X map); size_t csmap_X_size(csmap_X map); csmap_X_iter_t csmap_X_find(const csmap_X* self, RawKey rkey); -csmap_X_value_t* csmap_X_find_it(const csmap_X* self, RawKey rkey, csmap_X_iter_t* out); // return NULL if not found +csmap_X_value_t* csmap_X_find_it(const csmap_X* self, RawKey rkey, csmap_X_iter_t* out); // return NULL if not found bool csmap_X_contains(const csmap_X* self, RawKey rkey); csmap_X_result_t csmap_X_insert(csmap_X* self, Key key, Mapped mapped); // no change if key in map csmap_X_result_t csmap_X_insert_or_assign(csmap_X* self, Key key, Mapped mapped); // always update mapped csmap_X_result_t csmap_X_emplace(csmap_X* self, RawKey rkey, RawMapped rmapped); // no change if rkey in map -csmap_X_result_t csmap_X_emplace_put(csmap_X* self, RawKey rkey, RawMapped rmapped); // always update rmapped +csmap_X_result_t csmap_X_emplace_or_assign(csmap_X* self, RawKey rkey, RawMapped rmapped); // always update rmapped void csmap_X_emplace_n(csmap_X* self, const csmap_X_rawvalue_t arr[], size_t size); csmap_X_mapped_t* csmap_X_at(const csmap_X* self, RawKey rkey); // rkey must be in map. @@ -149,7 +149,7 @@ int main() {110, "Blue"}, }); /* put replaces existing mapped value: */ - csmap_id_emplace_put(&idnames, 110, "White"); + csmap_id_emplace_or_assign(&idnames, 110, "White"); /* put a constructed mapped value into map: */ csmap_id_insert_or_assign(&idnames, 120, cstr_from_fmt("#%08x", col)); /* emplace inserts only when key does not exist: */ diff --git a/docs/cvec_api.md b/docs/cvec_api.md index 8bc3e67e..f79ad3b0 100644 --- a/docs/cvec_api.md +++ b/docs/cvec_api.md @@ -82,7 +82,7 @@ cvec_X_iter_t cvec_X_erase_range_p(cvec_X* self, cvec_X_value_t* pfirst, c cvec_X_iter_t cvec_X_find(const cvec_X* self, RawValue raw); cvec_X_iter_t cvec_X_find_in_range(cvec_X_iter_t i1, cvec_X_iter_t i2, RawValue raw); -bool cvec_X_bsearch(const cvec_X* self); +bool cvec_X_bsearch(const cvec_X* self, RawValue raw); bool cvec_X_bsearch_in_range(cvec_X_iter_t i1, cvec_X_iter_t i2, RawValue raw); void cvec_X_sort(cvec_X* self); void cvec_X_sort_range(cvec_X_iter_t i1, cvec_X_iter_t i2, @@ -116,7 +116,7 @@ int main() { // Create a vector containing integers cvec_i vec = cvec_i_init(); - c_emplace_n(&vec, cvec_i, {7, 5, 16, 8}); + c_emplace_items(&vec, cvec_i, {7, 5, 16, 8}); // Add two more integers to vector cvec_i_push_back(&vec, 25); diff --git a/examples/advanced.c b/examples/advanced.c index 01efc10c..391230f6 100644 --- a/examples/advanced.c +++ b/examples/advanced.c @@ -42,12 +42,12 @@ using_cmap_keyarg(vk, Viking, int, vikingraw_equals, vikingraw_hash, int main() { cmap_vk vikings = cmap_vk_init(); - c_emplace_n(&vikings, cmap_vk, { + c_emplace_items(&vikings, cmap_vk, { { {"Einar", "Norway"}, 20}, { {"Olaf", "Denmark"}, 24}, { {"Harald", "Iceland"}, 12}, }); - cmap_vk_emplace_put(&vikings, (VikingRaw){"Bjorn", "Sweden"}, 10); + cmap_vk_emplace_or_assign(&vikings, (VikingRaw){"Bjorn", "Sweden"}, 10); VikingRaw lookup = {"Einar", "Norway"}; diff --git a/examples/csmap_v1.h b/examples/csmap_v1.h index 4e785a2b..11602f83 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##_emplace_put(C##_##X* self, RawKey rkey MAP_ONLY_##C(, RawMapped rmapped)) { \ + C##_##X##_emplace_or_assign(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); \ diff --git a/examples/demos.c b/examples/demos.c index 828a2c26..f60355e2 100644 --- a/examples/demos.c +++ b/examples/demos.c @@ -136,9 +136,9 @@ void mapdemo2() { printf("\nMAPDEMO2\n"); cmap_si nums = cmap_si_init(); - cmap_si_emplace_put(&nums, "Hello", 64); - cmap_si_emplace_put(&nums, "Groovy", 121); - cmap_si_emplace_put(&nums, "Groovy", 200); // overwrite previous + cmap_si_emplace_or_assign(&nums, "Hello", 64); + cmap_si_emplace_or_assign(&nums, "Groovy", 121); + cmap_si_emplace_or_assign(&nums, "Groovy", 200); // overwrite previous // iterate the map: for (cmap_si_iter_t i = cmap_si_begin(&nums); i.ref != cmap_si_end(&nums).ref; cmap_si_next(&i)) diff --git a/examples/inits.c b/examples/inits.c index fd5fdbd3..bf209e88 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_emplace_n(&floats, cvec_f, {4.0f, 2.0f, 5.0f, 3.0f, 1.0f}); + c_emplace_items(&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_emplace_n(&floats, cpque_f, {40.0f, 20.0f, 50.0f, 30.0f, 10.0f}); + c_emplace_items(&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_emplace_n(&countries, cmap_cnt, { + c_emplace_items(&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_emplace_n(&pairs1, cvec_ip, { + c_emplace_items(&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_emplace_n(&pairs2, clist_ip, { + c_emplace_items(&pairs2, clist_ip, { {5, 6}, {3, 4}, {1, 2}, diff --git a/examples/list.c b/examples/list.c index 47b17f2c..7ac49e19 100644 --- a/examples/list.c +++ b/examples/list.c @@ -33,7 +33,7 @@ int main() { puts(""); clist_fx_clear(&list); - c_emplace_n(&list, clist_fx, {10, 20, 30, 40, 30, 50}); + c_emplace_items(&list, clist_fx, {10, 20, 30, 40, 30, 50}); c_foreach (i, clist_fx, list) printf(" %g", *i.ref); puts(""); diff --git a/examples/mapmap.c b/examples/mapmap.c index c55104c9..5a5996f6 100644 --- a/examples/mapmap.c +++ b/examples/mapmap.c @@ -16,7 +16,7 @@ int main(void) { cmap_str_emplace(&cmap_cfg_insert(&config, cstr_from("group"), init).first->second, "proj3", "Oil"); cmap_str_emplace(&cmap_cfg_insert(&config, cstr_from("admin"), init).first->second, "employees", "2302"); - cmap_str_emplace_put(&cmap_cfg_insert(&config, cstr_from("group"), init).first->second, "proj2", "Wind"); // Update + cmap_str_emplace_or_assign(&cmap_cfg_insert(&config, cstr_from("group"), init).first->second, "proj2", "Wind"); // Update c_foreach (i, cmap_cfg, config) c_foreach (j, cmap_str, i.ref->second) diff --git a/examples/phonebook.c b/examples/phonebook.c index 34364bcb..6b2ec687 100644 --- a/examples/phonebook.c +++ b/examples/phonebook.c @@ -67,7 +67,7 @@ int main(int argc, char **argv) printf("\nPhone book after erasing Tariq and Elliott:\n"); print_phone_book(phone_book); - cmap_str_emplace_put(&phone_book, "Zak Byers", "(555) 396-188"); + cmap_str_emplace_or_assign(&phone_book, "Zak Byers", "(555) 396-188"); printf("\nPhone book after update phone of Zak Byers:\n"); print_phone_book(phone_book); diff --git a/examples/priority.c b/examples/priority.c index 4955a6aa..10e2f32a 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_emplace_n(&heap, cpque_i, {-231, -32, -873, -4, -343}); + c_emplace_items(&heap, cpque_i, {-231, -32, -873, -4, -343}); c_forrange (N) cpque_i_push(&heap, stc64_uniform(&rng, &dist)); diff --git a/examples/stc_astar.c b/examples/stc_astar.c index e7bb86e5..cdf1ff3c 100644 --- a/examples/stc_astar.c +++ b/examples/stc_astar.c @@ -106,10 +106,10 @@ astar(cstr maze, int width) csmap_mc_value_t* cost = csmap_mc_find(&cost_so_far, next).ref; if (!cost || new_cost < cost->second) { - csmap_mc_emplace_put(&cost_so_far, next, new_cost); // update (put) + csmap_mc_emplace_or_assign(&cost_so_far, next, new_cost); // update (put) next.priorty = new_cost + abs(goal.x - next.x) + abs(goal.y - next.y); cpque_mp_push(&frontier, next); - csmap_ms_emplace_put(&came_from, next, current); + csmap_ms_emplace_or_assign(&came_from, next, current); } } } diff --git a/stc/ccommon.h b/stc/ccommon.h index 50626b36..d3ceed52 100644 --- a/stc/ccommon.h +++ b/stc/ccommon.h @@ -117,9 +117,9 @@ #define c_breakwith continue #define c_init(ctype, c, ...) \ - ctype c = ctype##_init(); c_emplace_n(&c, ctype, __VA_ARGS__) + ctype c = ctype##_init(); c_emplace_items(&c, ctype, __VA_ARGS__) -#define c_emplace_n(self, ctype, ...) do { \ +#define c_emplace_items(self, ctype, ...) do { \ const ctype##_rawvalue_t __arr[] = __VA_ARGS__; \ ctype##_emplace_n(self, __arr, c_arraylen(__arr)); \ } while (0) diff --git a/stc/cmap.h b/stc/cmap.h index 01d54dc5..64bf4f9c 100644 --- a/stc/cmap.h +++ b/stc/cmap.h @@ -44,7 +44,7 @@ int main(void) { cmap_mx_emplace(&m, 12, 'c'); cmap_mx_iter_t it = cmap_mx_find(&m, 10); // none char val = cmap_mx_find(&m, 5).ref->second; - cmap_mx_emplace_put(&m, 5, 'd'); // update + cmap_mx_emplace_or_assign(&m, 5, 'd'); // update cmap_mx_erase(&m, 8); c_foreach (i, cmap_mx, m) printf("map %d: %c\n", i.ref->first, i.ref->second); @@ -262,7 +262,7 @@ typedef struct {size_t idx; uint32_t hx;} chash_bucket_t; return res; \ } \ STC_INLINE C##_##X##_result_t \ - C##_##X##_emplace_put(C##_##X* self, RawKey rkey MAP_ONLY_##C(, RawMapped rmapped)) { \ + C##_##X##_emplace_or_assign(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); \ diff --git a/stc/csmap.h b/stc/csmap.h index e56f4fb2..b2ec53d5 100644 --- a/stc/csmap.h +++ b/stc/csmap.h @@ -254,7 +254,7 @@ struct csmap_rep { size_t root, disp, head, size, cap; void* nodes[]; }; return res; \ } \ STC_INLINE C##_##X##_result_t \ - C##_##X##_emplace_put(C##_##X* self, RawKey rkey MAP_ONLY_##C(, RawMapped rmapped)) { \ + C##_##X##_emplace_or_assign(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); \ diff --git a/stc/cvec.h b/stc/cvec.h index 5899132e..14e353be 100644 --- a/stc/cvec.h +++ b/stc/cvec.h @@ -184,7 +184,7 @@ typedef int (*c_cmp_fn)(const void*, const void*); STC_API cvec_##X##_iter_t \ cvec_##X##_bsearch_in_range(cvec_##X##_iter_t i1, cvec_##X##_iter_t i2, RawValue raw); \ STC_INLINE cvec_##X##_iter_t \ - cvec_##X##_bsearch(cvec_##X* self, RawValue raw) { \ + cvec_##X##_bsearch(const cvec_##X* self, RawValue raw) { \ return cvec_##X##_bsearch_in_range(cvec_##X##_begin(self), cvec_##X##_end(self), raw); \ } \ STC_INLINE void \ -- cgit v1.2.3