diff options
| author | Tyge Lovset <[email protected]> | 2023-05-20 07:24:45 +0200 |
|---|---|---|
| committer | Tyge Lovset <[email protected]> | 2023-05-20 07:24:45 +0200 |
| commit | 6cd19a9ebdb5fb83f798c3d69d82e3ff08edaad4 (patch) | |
| tree | f222762122151d590c581f795b3f75598565661c /docs | |
| parent | ed9ccf1dcca8d3651e13ff1686148b4b23773721 (diff) | |
| parent | bb59d9c87f8d99f50c439351480c0ec8d6eea38e (diff) | |
| download | STC-modified-6cd19a9ebdb5fb83f798c3d69d82e3ff08edaad4.tar.gz STC-modified-6cd19a9ebdb5fb83f798c3d69d82e3ff08edaad4.zip | |
Merge branch 'dev43' of github.com:stclib/STC into dev43
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/cbox_api.md | 2 | ||||
| -rw-r--r-- | docs/ccommon_api.md | 10 | ||||
| -rw-r--r-- | docs/clist_api.md | 8 | ||||
| -rw-r--r-- | docs/cmap_api.md | 2 | ||||
| -rw-r--r-- | docs/cset_api.md | 2 | ||||
| -rw-r--r-- | docs/csmap_api.md | 4 | ||||
| -rw-r--r-- | docs/cspan_api.md | 4 | ||||
| -rw-r--r-- | docs/csset_api.md | 2 |
8 files changed, 17 insertions, 17 deletions
diff --git a/docs/cbox_api.md b/docs/cbox_api.md index ca4d90da..5914a5ad 100644 --- a/docs/cbox_api.md +++ b/docs/cbox_api.md @@ -92,7 +92,7 @@ void int_drop(int* x) { int main() { - IVec vec = c_make(Vec, {2021, 2012, 2022, 2015}); + IVec vec = c_init(Vec, {2021, 2012, 2022, 2015}); ISet set = {0}; c_defer( IVec_drop(&vec), diff --git a/docs/ccommon_api.md b/docs/ccommon_api.md index eaf01996..56424989 100644 --- a/docs/ccommon_api.md +++ b/docs/ccommon_api.md @@ -18,7 +18,7 @@ #define i_tag ii #include <stc/csmap.h> ... -csmap_ii map = c_make(csmap_ii, { {23,1}, {3,2}, {7,3}, {5,4}, {12,5} }); +csmap_ii map = c_init(csmap_ii, { {23,1}, {3,2}, {7,3}, {5,4}, {12,5} }); c_foreach (i, csmap_ii, map) printf(" %d", i.ref->first); @@ -158,7 +158,7 @@ Note that `c_flt_take()` and `c_flt_takewhile()` breaks the loop on false. --- ## Generic algorithms -### c_make, c_drop +### c_init, c_drop Make any container from an initializer list: ```c @@ -170,11 +170,11 @@ Make any container from an initializer list: #include <stc/cmap.h> ... // Initializes with const char*, internally converted to cstr! -cset_str myset = c_make(cset_str, {"This", "is", "the", "story"}); +cset_str myset = c_init(cset_str, {"This", "is", "the", "story"}); cset_str myset2 = c_clone(myset); int x = 7, y = 8; -cmap_int mymap = c_make(cmap_int, { {1, 2}, {3, 4}, {5, 6}, {x, y} }); +cmap_int mymap = c_init(cmap_int, { {1, 2}, {3, 4}, {5, 6}, {x, y} }); ``` Drop multiple containers of the same type: ```c @@ -232,7 +232,7 @@ possible and very fast. Note that `i_more` must be defined to pick up template p #include <stdio.h> int main() { - MyDeq deq = c_make(MyDeq, {5, 3, 5, 9, 7, 4, 7, 2, 4, 9, 3, 1, 2, 6, 4}); + MyDeq deq = c_init(MyDeq, {5, 3, 5, 9, 7, 4, 7, 2, 4, 9, 3, 1, 2, 6, 4}); MyDeq_sort_n(&deq, MyDeq_size(&deq)); c_foreach (i, MyDeq, deq) printf(" %d", *i.ref); MyDeq_drop(&deq); diff --git a/docs/clist_api.md b/docs/clist_api.md index eb84fbd4..36935c88 100644 --- a/docs/clist_api.md +++ b/docs/clist_api.md @@ -124,7 +124,7 @@ Interleave *push_front()* / *push_back()* then *sort()*: #include <stdio.h> int main() { - DList list = c_make(DList, {10., 20., 30., 40., 50., 60., 70., 80., 90.}); + DList list = c_init(DList, {10., 20., 30., 40., 50., 60., 70., 80., 90.}); c_forrange (i, 1, 10) { if (i & 1) DList_push_front(&list, (double) i); @@ -162,7 +162,7 @@ Use of *erase_at()* and *erase_range()*: int main () { - clist_i L = c_make(clist_i, {10, 20, 30, 40, 50}); + clist_i L = c_init(clist_i, {10, 20, 30, 40, 50}); // 10 20 30 40 50 clist_i_iter it = clist_i_begin(&L); // ^ clist_i_next(&it); @@ -196,8 +196,8 @@ Splice `[30, 40]` from *L2* into *L1* before `3`: #include <stdio.h> int main() { - clist_i L1 = c_make(clist_i, {1, 2, 3, 4, 5}); - clist_i L2 = c_make(clist_i, {10, 20, 30, 40, 50}); + clist_i L1 = c_init(clist_i, {1, 2, 3, 4, 5}); + clist_i L2 = c_init(clist_i, {10, 20, 30, 40, 50}); clist_i_iter i = clist_i_advance(clist_i_begin(&L1), 2); clist_i_iter j1 = clist_i_advance(clist_i_begin(&L2), 2), j2 = clist_i_advance(j1, 2); diff --git a/docs/cmap_api.md b/docs/cmap_api.md index cdb57534..2c9ac8ed 100644 --- a/docs/cmap_api.md +++ b/docs/cmap_api.md @@ -123,7 +123,7 @@ bool c_memcmp_eq(const i_keyraw* a, const i_keyraw* b); // ! int main() { // Create an unordered_map of three strings (that map to strings) - cmap_str umap = c_make(cmap_str, { + cmap_str umap = c_init(cmap_str, { {"RED", "#FF0000"}, {"GREEN", "#00FF00"}, {"BLUE", "#0000FF"} diff --git a/docs/cset_api.md b/docs/cset_api.md index b9e8ae99..7243beb3 100644 --- a/docs/cset_api.md +++ b/docs/cset_api.md @@ -86,7 +86,7 @@ int main () { Strset first, second={0}, third={0}, fourth={0}, fifth; - first = c_make(Strset, {"red", "green", "blue"}); + first = c_init(Strset, {"red", "green", "blue"}); fifth = Strset_clone(second); c_forlist (i, const char*, {"orange", "pink", "yellow"}) diff --git a/docs/csmap_api.md b/docs/csmap_api.md index 8c2048c0..b1bb07c6 100644 --- a/docs/csmap_api.md +++ b/docs/csmap_api.md @@ -111,7 +111,7 @@ void csmap_X_value_drop(csmap_X_value* pval); int main() { // Create a sorted map of three strings (maps to string) - csmap_str colors = c_make(csmap_str, { + csmap_str colors = c_init(csmap_str, { {"RED", "#FF0000"}, {"GREEN", "#00FF00"}, {"BLUE", "#0000FF"} @@ -192,7 +192,7 @@ This example uses a csmap with cstr as mapped value. int main() { uint32_t col = 0xcc7744ff; - IDSMap idnames = c_make(IDSMap, { {100, "Red"}, {110, "Blue"} }); + IDSMap idnames = c_init(IDSMap, { {100, "Red"}, {110, "Blue"} }); // Assign/overwrite an existing mapped value with a const char* IDSMap_emplace_or_assign(&idnames, 110, "White"); diff --git a/docs/cspan_api.md b/docs/cspan_api.md index 10565b0f..ec203460 100644 --- a/docs/cspan_api.md +++ b/docs/cspan_api.md @@ -143,8 +143,8 @@ using_cspan3(Span, int); // Shorthand to define Span, Span2, and Span3 int main() { - // c_make() can create any STC container/span from an initializer list: - Span span = c_make(Span, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + // c_init() can create any STC container/span from an initializer list: + Span span = c_init(Span, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}); // create a 3d cspan: Span3 span3 = cspan_md(span.data, 2, 4, 3); diff --git a/docs/csset_api.md b/docs/csset_api.md index d095696c..dafe6670 100644 --- a/docs/csset_api.md +++ b/docs/csset_api.md @@ -86,7 +86,7 @@ int main () { SSet second={0}, third={0}, fourth={0}, fifth={0}; - second = c_make(SSet, {"red", "green", "blue"}); + second = c_init(SSet, {"red", "green", "blue"}); c_forlist (i, const char*, {"orange", "pink", "yellow"}) SSet_emplace(&third, *i.ref); |
