summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-02-21 19:44:29 +0100
committerTyge Løvset <[email protected]>2021-02-21 19:44:29 +0100
commit9ad1de563150b5819a17ceb07e5bb1a83f39f2b4 (patch)
tree6b1e6fbf4dab50917b85642663c4a496199db1c6 /docs
parentc609469b3eac08cc369f30a54cc737a3d9cadc3b (diff)
downloadSTC-modified-9ad1de563150b5819a17ceb07e5bb1a83f39f2b4.tar.gz
STC-modified-9ad1de563150b5819a17ceb07e5bb1a83f39f2b4.zip
Renamed emplace_put() to emplace_or_assign(). May add put() as alias to insert_or_assign().
Diffstat (limited to 'docs')
-rw-r--r--docs/ccommon_api.md6
-rw-r--r--docs/cdeq_api.md2
-rw-r--r--docs/cmap_api.md6
-rw-r--r--docs/cpque_api.md2
-rw-r--r--docs/cptr_api.md12
-rw-r--r--docs/csmap_api.md6
-rw-r--r--docs/cvec_api.md4
7 files changed, 19 insertions, 19 deletions
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);