summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authortylov <[email protected]>2023-07-12 19:39:59 +0200
committertylov <[email protected]>2023-07-12 21:01:46 +0200
commitebe5abc29d51c643520301e42124365477f44957 (patch)
treef1188f5c649f4244c384484ae584894280396272 /docs
parent715a02ba8155de2f7d446e8d7d2ae305c27996b9 (diff)
downloadSTC-modified-ebe5abc29d51c643520301e42124365477f44957.tar.gz
STC-modified-ebe5abc29d51c643520301e42124365477f44957.zip
Changed docs and examples to use i_key* template parameters instead of i_val* for all non-maps.
Renamed c_ASSERT() to c_assert() and added optional message parameter to c_static_assert().
Diffstat (limited to 'docs')
-rw-r--r--docs/carc_api.md38
-rw-r--r--docs/cbox_api.md52
-rw-r--r--docs/ccommon_api.md10
-rw-r--r--docs/cdeq_api.md54
-rw-r--r--docs/clist_api.md56
-rw-r--r--docs/cpque_api.md32
-rw-r--r--docs/cqueue_api.md28
-rw-r--r--docs/cset_api.md2
-rw-r--r--docs/cspan_api.md7
-rw-r--r--docs/csset_api.md2
-rw-r--r--docs/cstack_api.md38
-rw-r--r--docs/csview_api.md2
-rw-r--r--docs/cvec_api.md64
13 files changed, 194 insertions, 191 deletions
diff --git a/docs/carc_api.md b/docs/carc_api.md
index 22e6bac2..254f868a 100644
--- a/docs/carc_api.md
+++ b/docs/carc_api.md
@@ -6,14 +6,14 @@ deallocated when the last remaining **carc** owning the object is destroyed with
The object is destroyed using *carc_X_drop()*. A **carc** may also own no objects, in which
case it is called empty. The *carc_X_cmp()*, *carc_X_drop()* methods are defined based on
-the `i_cmp` and `i_valdrop` macros specified. Use *carc_X_clone(p)* when sharing ownership of
+the `i_cmp` and `i_keydrop` macros specified. Use *carc_X_clone(p)* when sharing ownership of
the pointed-to object.
All **carc** functions can be called by multiple threads on different instances of **carc** without
additional synchronization even if these instances are copies and share ownership of the same object.
**carc** uses thread-safe atomic reference counting, through the *carc_X_clone()* and *carc_X_drop()* methods.
-When declaring a container with shared pointers, define `i_valboxed` with the carc type, see example.
+When declaring a container with shared pointers, define `i_keyboxed` with the carc type, see example.
See similar c++ class [std::shared_ptr](https://en.cppreference.com/w/cpp/memory/shared_ptr) for a functional reference, or Rust [std::sync::Arc](https://doc.rust-lang.org/std/sync/struct.Arc.html) / [std::rc::Rc](https://doc.rust-lang.org/std/rc/struct.Rc.html).
@@ -21,14 +21,14 @@ See similar c++ class [std::shared_ptr](https://en.cppreference.com/w/cpp/memory
```c
#define i_type // full typename of the carc
-#define i_val // value: REQUIRED
+#define i_key // element type: REQUIRED
-#define i_valraw // convertion "raw" type - defaults to i_val
-#define i_valto // convertion func i_val* => i_valraw: REQUIRED IF i_valraw defined.
-#define i_valfrom // convertion func i_valraw => i_val
+#define i_keyraw // convertion "raw" type - defaults to i_key
+#define i_keyto // convertion func i_key* => i_keyraw: REQUIRED IF i_keyraw defined.
+#define i_keyfrom // convertion func i_keyraw => i_key
#define i_opt c_no_atomic // Non-atomic reference counting, like Rust Rc.
-#define i_tag // alternative typename: carc_{i_tag}. i_tag defaults to i_val
+#define i_tag // alternative typename: carc_{i_tag}. i_tag defaults to i_key
#include <stc/carc.h>
```
`X` should be replaced by the value of `i_tag` in all of the following documentation.
@@ -36,9 +36,9 @@ See similar c++ class [std::shared_ptr](https://en.cppreference.com/w/cpp/memory
## Methods
```c
carc_X carc_X_init(); // empty shared pointer
-carc_X carc_X_from(i_valraw raw); // create an carc from raw type (available if i_valraw defined by user).
-carc_X carc_X_from_ptr(i_val* p); // create an carc from raw pointer. Takes ownership of p.
-carc_X carc_X_make(i_val val); // create an carc from constructed val object. Faster than from_ptr().
+carc_X carc_X_from(i_keyraw raw); // create an carc from raw type (available if i_keyraw defined by user).
+carc_X carc_X_from_ptr(i_key* p); // create an carc from raw pointer. Takes ownership of p.
+carc_X carc_X_make(i_key key); // create an carc from constructed key object. Faster than from_ptr().
carc_X carc_X_clone(carc_X other); // return other with increased use count
carc_X carc_X_move(carc_X* self); // transfer ownership to receiver; self becomes NULL
@@ -49,7 +49,7 @@ void carc_X_drop(carc_X* self); // destruct (decr
long carc_X_use_count(const carc_X* self);
void carc_X_reset(carc_X* self);
-void carc_X_reset_to(carc_X* self, i_val* p); // assign new carc from ptr. Takes ownership of p.
+void carc_X_reset_to(carc_X* self, i_key* p); // assign new carc from ptr. Takes ownership of p.
uint64_t carc_X_hash(const carc_X* x); // hash value
int carc_X_cmp(const carc_X* x, const carc_X* y); // compares pointer addresses if no `i_cmp` is specified.
@@ -58,9 +58,9 @@ bool carc_X_eq(const carc_X* x, const carc_X* y); // carc_X_cmp() =
// functions on pointed to objects.
-uint64_t carc_X_value_hash(const i_val* x);
-int carc_X_value_cmp(const i_val* x, const i_val* y);
-bool carc_X_value_eq(const i_val* x, const i_val* y);
+uint64_t carc_X_value_hash(const i_key* x);
+int carc_X_value_cmp(const i_key* x, const i_key* y);
+bool carc_X_value_eq(const i_key* x, const i_key* y);
```
## Types and constants
@@ -69,8 +69,8 @@ bool carc_X_value_eq(const i_val* x, const i_val* y);
|:------------------|:--------------------------------------------------|:-----------------------|
| `carc_null` | `{0}` | Init nullptr const |
| `carc_X` | `struct { carc_X_value* get; long* use_count; }` | The carc type |
-| `carc_X_value` | `i_val` | The carc element type |
-| `carc_X_raw` | `i_valraw` | Convertion type |
+| `carc_X_value` | `i_key` | The carc element type |
+| `carc_X_raw` | `i_keyraw` | Convertion type |
## Example
@@ -89,12 +89,12 @@ bool carc_X_value_eq(const i_val* x, const i_val* y);
#include <stc/csmap.h>
#define i_type Arc // (atomic) ref. counted pointer
-#define i_val Map
-#define i_valdrop(p) (printf("drop Arc:\n"), Map_drop(p))
+#define i_key Map
+#define i_keydrop(p) (printf("drop Arc:\n"), Map_drop(p))
#include <stc/carc.h>
#define i_type Stack
-#define i_valboxed Arc // Note: use i_valboxed for carc or cbox value types
+#define i_keyboxed Arc // Note: use i_keyboxed for carc or cbox value types
#include <stc/cstack.h>
int main()
diff --git a/docs/cbox_api.md b/docs/cbox_api.md
index 9151f56d..83d59521 100644
--- a/docs/cbox_api.md
+++ b/docs/cbox_api.md
@@ -2,11 +2,11 @@
**cbox** is a smart pointer to a heap allocated value of type X. A **cbox** can
be empty. The *cbox_X_cmp()*, *cbox_X_drop()* methods are defined based on the `i_cmp`
-and `i_valdrop` macros specified. Use *cbox_X_clone(p)* to make a deep copy, which uses the
-`i_valclone` macro if defined.
+and `i_keydrop` macros specified. Use *cbox_X_clone(p)* to make a deep copy, which uses the
+`i_keyclone` macro if defined.
-When declaring a container of **cbox** values, define `i_valboxed` with the
-cbox type instead of defining `i_val`. This will auto-set `i_valdrop`, `i_valclone`, and `i_cmp` using
+When declaring a container of **cbox** values, define `i_keyboxed` with the
+cbox type instead of defining `i_key`. This will auto-set `i_keydrop`, `i_keyclone`, and `i_cmp` using
functions defined by the specified **cbox**.
See similar c++ class [std::unique_ptr](https://en.cppreference.com/w/cpp/memory/unique_ptr) for a functional reference, or Rust [std::boxed::Box](https://doc.rust-lang.org/std/boxed/struct.Box.html)
@@ -15,29 +15,29 @@ See similar c++ class [std::unique_ptr](https://en.cppreference.com/w/cpp/memory
```c
#define i_type // full typename of the cbox
-#define i_val // value: REQUIRED
-#define i_cmp // three-way compare two i_val* : REQUIRED IF i_val is a non-integral type
-#define i_valdrop // destroy value func - defaults to empty destruct
-#define i_valclone // REQUIRED if i_valdrop is defined, unless 'i_opt c_no_clone' is defined.
+#define i_key // element type: REQUIRED
+#define i_cmp // three-way compare two i_key* : REQUIRED IF i_key is a non-integral type
+#define i_keydrop // destroy element func - defaults to empty destruct
+#define i_keyclone // REQUIRED if i_keydrop is defined, unless 'i_opt c_no_clone' is defined.
-#define i_valraw // convertion type (lookup): default to {i_val}
-#define i_valto // convertion func i_val* => i_valraw: REQUIRED IF i_valraw defined.
-#define i_valfrom // from-raw func.
+#define i_keyraw // convertion type (lookup): default to {i_key}
+#define i_keyto // convertion func i_key* => i_keyraw: REQUIRED IF i_keyraw defined.
+#define i_keyfrom // from-raw func.
-#define i_valclass // alt. to i_val: REQUIRES that {i_val}_clone, {i_val}_drop, {i_valraw}_cmp exist.
-#define i_tag // alternative typename: cbox_{i_tag}. i_tag defaults to i_val
+#define i_keyclass // alt. to i_key: REQUIRES that {i_key}_clone, {i_key}_drop, {i_keyraw}_cmp exist.
+#define i_tag // alternative typename: cbox_{i_tag}. i_tag defaults to i_key
#include <stc/cbox.h>
```
`X` should be replaced by the value of `i_tag` in all of the following documentation.
-Define `i_opt` with `c_no_cmp` if comparison between i_val's is not needed/available. Will then
+Define `i_opt` with `c_no_cmp` if comparison between i_key's is not needed/available. Will then
compare the pointer addresses when used. Additionally, `c_no_clone` or `i_is_fwd` may be defined.
## Methods
```c
cbox_X cbox_X_init(); // return an empty cbox
-cbox_X cbox_X_from(i_valraw raw); // create a cbox from raw type. Avail if i_valraw user defined.
-cbox_X cbox_X_from_ptr(i_val* ptr); // create a cbox from a pointer. Takes ownership of ptr.
-cbox_X cbox_X_make(i_val val); // create a cbox from unowned val object.
+cbox_X cbox_X_from(i_keyraw raw); // create a cbox from raw type. Avail if i_keyraw user defined.
+cbox_X cbox_X_from_ptr(i_key* ptr); // create a cbox from a pointer. Takes ownership of ptr.
+cbox_X cbox_X_make(i_key val); // create a cbox from unowned val object.
cbox_X cbox_X_clone(cbox_X other); // return deep copied clone
cbox_X cbox_X_move(cbox_X* self); // transfer ownership to receiving cbox returned. self becomes NULL.
@@ -46,7 +46,7 @@ void cbox_X_assign(cbox_X* self, cbox_X* moved); // transfer owners
void cbox_X_drop(cbox_X* self); // destruct the contained object and free its heap memory.
void cbox_X_reset(cbox_X* self);
-void cbox_X_reset_to(cbox_X* self, i_val* p); // assign new cbox from ptr. Takes ownership of p.
+void cbox_X_reset_to(cbox_X* self, i_key* p); // assign new cbox from ptr. Takes ownership of p.
uint64_t cbox_X_hash(const cbox_X* x); // hash value
int cbox_X_cmp(const cbox_X* x, const cbox_X* y); // compares pointer addresses if no `i_cmp` is specified.
@@ -55,9 +55,9 @@ bool cbox_X_eq(const cbox_X* x, const cbox_X* y); // cbox_X_cmp() ==
// functions on pointed to objects.
-uint64_t cbox_X_value_hash(const i_val* x);
-int cbox_X_value_cmp(const i_val* x, const i_val* y);
-bool cbox_X_value_eq(const i_val* x, const i_val* y);
+uint64_t cbox_X_value_hash(const i_key* x);
+int cbox_X_value_cmp(const i_key* x, const i_key* y);
+bool cbox_X_value_eq(const i_key* x, const i_key* y);
```
## Types and constants
@@ -66,7 +66,7 @@ bool cbox_X_value_eq(const i_val* x, const i_val* y);
|:-------------------|:--------------------------------|:------------------------|
| `cbox_null` | `{0}` | Init nullptr const |
| `cbox_X` | `struct { cbox_X_value* get; }` | The cbox type |
-| `cbox_X_value` | `i_val` | The cbox element type |
+| `cbox_X_value` | `i_key` | The cbox element type |
## Example
@@ -77,9 +77,9 @@ void int_drop(int* x) {
}
#define i_type IBox
-#define i_val int
-#define i_valdrop int_drop // optional func, just to display elements destroyed
-#define i_valclone(x) x // must specified when i_valdrop is defined.
+#define i_key int
+#define i_keydrop int_drop // optional func, just to display elements destroyed
+#define i_keyclone(x) x // must specified when i_keydrop is defined.
#include <stc/cbox.h>
#define i_type ISet
@@ -87,7 +87,7 @@ void int_drop(int* x) {
#include <stc/csset.h> // ISet : std::set<std::unique_ptr<int>>
#define i_type IVec
-#define i_valboxed IBox // NB: use i_valboxed instead of i_val
+#define i_keyboxed IBox // NB: use i_keyboxed instead of i_key
#include <stc/cvec.h> // IVec : std::vector<std::unique_ptr<int>>
int main()
diff --git a/docs/ccommon_api.md b/docs/ccommon_api.md
index 7569bb5b..52ad88e4 100644
--- a/docs/ccommon_api.md
+++ b/docs/ccommon_api.md
@@ -162,7 +162,7 @@ Note that `c_flt_take()` and `c_flt_takewhile()` breaks the loop on false.
Make any container from an initializer list:
```c
-#define i_val_str // owned cstr string value type
+#define i_key_str // owned cstr string value type
#include <stc/cset.h>
#define i_key int
@@ -210,7 +210,7 @@ You may customize `i_tag` and the comparison function `i_cmp` or `i_less`.
There is a [benchmark/test file here](../misc/benchmarks/various/csort_bench.c).
```c
-#define i_val int
+#define i_key int
#include <stc/algo/sort.h>
#include <stdio.h>
@@ -224,7 +224,7 @@ Containers with random access may also be sorted. Even sorting cdeq/cqueue (with
possible and very fast. Note that `i_more` must be defined to retain specified template parameters for use by sort:
```c
#define i_type MyDeq
-#define i_val int
+#define i_key int
#define i_more
#include <stc/cdeq.h> // deque
#include <stc/algo/sort.h>
@@ -273,7 +273,7 @@ int* ip = c_const_cast(int*, cs); // issues a warning!
### Predefined template parameter functions
-**crawstr** - Non-owned `const char*` "class" element type: `#define i_valclass crawstr`
+**crawstr** - Non-owned `const char*` "class" element type: `#define i_keyclass crawstr`
```c
typedef const char* crawstr;
int crawstr_cmp(const crawstr* x, const crawstr* y);
@@ -485,7 +485,7 @@ return ok;
#define i_implement
#include <stc/cstr.h>
-#define i_val_str
+#define i_key_str
#include <stc/cvec.h>
// receiver should check errno variable
diff --git a/docs/cdeq_api.md b/docs/cdeq_api.md
index 5a00d69a..292b0933 100644
--- a/docs/cdeq_api.md
+++ b/docs/cdeq_api.md
@@ -11,16 +11,16 @@ See the c++ class [std::deque](https://en.cppreference.com/w/cpp/container/deque
```c
#define i_type // full typename of the container
-#define i_val // value: REQUIRED
-#define i_cmp // three-way compare two i_valraw* : REQUIRED IF i_valraw is a non-integral type
-#define i_valdrop // destroy value func - defaults to empty destruct
-#define i_valclone // REQUIRED IF i_valdrop defined
+#define i_key // value: REQUIRED
+#define i_cmp // three-way compare two i_keyraw* : REQUIRED IF i_keyraw is a non-integral type
+#define i_keydrop // destroy value func - defaults to empty destruct
+#define i_keyclone // REQUIRED IF i_keydrop defined
-#define i_valraw // convertion "raw" type - defaults to i_val
-#define i_valfrom // convertion func i_valraw => i_val
-#define i_valto // convertion func i_val* => i_valraw
+#define i_keyraw // convertion "raw" type - defaults to i_key
+#define i_keyfrom // convertion func i_keyraw => i_key
+#define i_keyto // convertion func i_key* => i_keyraw
-#define i_tag // alternative typename: cdeq_{i_tag}. i_tag defaults to i_val
+#define i_tag // alternative typename: cdeq_{i_tag}. i_tag defaults to i_key
#include <stc/cdeq.h>
```
`X` should be replaced by the value of `i_tag` in all of the following documentation.
@@ -44,30 +44,30 @@ intptr_t cdeq_X_capacity(const cdeq_X* self);
const cdeq_X_value* cdeq_X_at(const cdeq_X* self, intptr_t idx);
cdeq_X_value* cdeq_X_at_mut(cdeq_X* self, intptr_t idx);
-const cdeq_X_value* cdeq_X_get(const cdeq_X* self, i_valraw raw); // return NULL if not found
-cdeq_X_value* cdeq_X_get_mut(cdeq_X* self, i_valraw raw); // mutable get
-cdeq_X_iter cdeq_X_find(const cdeq_X* self, i_valraw raw);
-cdeq_X_iter cdeq_X_find_in(cdeq_X_iter i1, cdeq_X_iter i2, i_valraw raw); // return cvec_X_end() if not found
+const cdeq_X_value* cdeq_X_get(const cdeq_X* self, i_keyraw raw); // return NULL if not found
+cdeq_X_value* cdeq_X_get_mut(cdeq_X* self, i_keyraw raw); // mutable get
+cdeq_X_iter cdeq_X_find(const cdeq_X* self, i_keyraw raw);
+cdeq_X_iter cdeq_X_find_in(cdeq_X_iter i1, cdeq_X_iter i2, i_keyraw raw); // return cvec_X_end() if not found
cdeq_X_value* cdeq_X_front(const cdeq_X* self);
cdeq_X_value* cdeq_X_back(const cdeq_X* self);
-cdeq_X_value* cdeq_X_push_front(cdeq_X* self, i_val value);
-cdeq_X_value* cdeq_X_emplace_front(cdeq_X* self, i_valraw raw);
+cdeq_X_value* cdeq_X_push_front(cdeq_X* self, i_key value);
+cdeq_X_value* cdeq_X_emplace_front(cdeq_X* self, i_keyraw raw);
void cdeq_X_pop_front(cdeq_X* self);
-cdeq_X_value* cdeq_X_push_back(cdeq_X* self, i_val value);
-cdeq_X_value* cdeq_X_push(cdeq_X* self, i_val value); // alias for push_back()
-cdeq_X_value* cdeq_X_emplace_back(cdeq_X* self, i_valraw raw);
-cdeq_X_value* cdeq_X_emplace(cdeq_X* self, i_valraw raw); // alias for emplace_back()
+cdeq_X_value* cdeq_X_push_back(cdeq_X* self, i_key value);
+cdeq_X_value* cdeq_X_push(cdeq_X* self, i_key value); // alias for push_back()
+cdeq_X_value* cdeq_X_emplace_back(cdeq_X* self, i_keyraw raw);
+cdeq_X_value* cdeq_X_emplace(cdeq_X* self, i_keyraw raw); // alias for emplace_back()
void cdeq_X_pop_back(cdeq_X* self);
-cdeq_X_iter cdeq_X_insert_n(cdeq_X* self, intptr_t idx, const i_val[] arr, intptr_t n); // move values
-cdeq_X_iter cdeq_X_insert_at(cdeq_X* self, cdeq_X_iter it, i_val value); // move value
+cdeq_X_iter cdeq_X_insert_n(cdeq_X* self, intptr_t idx, const i_key[] arr, intptr_t n); // move values
+cdeq_X_iter cdeq_X_insert_at(cdeq_X* self, cdeq_X_iter it, i_key value); // move value
cdeq_X_iter cdeq_X_insert_uninit(cdeq_X* self, intptr_t idx, intptr_t n); // uninitialized data
// copy values:
-cdeq_X_iter cdeq_X_emplace_n(cdeq_X* self, intptr_t idx, const i_valraw[] arr, intptr_t n);
-cdeq_X_iter cdeq_X_emplace_at(cdeq_X* self, cdeq_X_iter it, i_valraw raw);
+cdeq_X_iter cdeq_X_emplace_n(cdeq_X* self, intptr_t idx, const i_keyraw[] arr, intptr_t n);
+cdeq_X_iter cdeq_X_emplace_at(cdeq_X* self, cdeq_X_iter it, i_keyraw raw);
void cdeq_X_erase_n(cdeq_X* self, intptr_t idx, intptr_t n);
cdeq_X_iter cdeq_X_erase_at(cdeq_X* self, cdeq_X_iter it);
@@ -88,14 +88,14 @@ void cdeq_X_value_drop(cdeq_X_value* pval);
| Type name | Type definition | Used to represent... |
|:-------------------|:------------------------------------|:-----------------------|
-| `cdeq_X` | `struct { cdeq_X_value* data; }` | The cdeq type |
-| `cdeq_X_value` | `i_val` | The cdeq value type |
-| `cdeq_X_raw` | `i_valraw` | The raw value type |
-| `cdeq_X_iter` | `struct { cdeq_X_value* ref; }` | The iterator type |
+| `cdeq_X` | `struct { cdeq_X_value* data; }` | The cdeq type |
+| `cdeq_X_value` | `i_key` | The cdeq value type |
+| `cdeq_X_raw` | `i_keyraw` | The raw value type |
+| `cdeq_X_iter` | `struct { cdeq_X_value* ref; }` | The iterator type |
## Examples
```c
-#define i_val int
+#define i_key int
#define i_tag i
#include <stc/cdeq.h>
diff --git a/docs/clist_api.md b/docs/clist_api.md
index 51b7af6a..023cca41 100644
--- a/docs/clist_api.md
+++ b/docs/clist_api.md
@@ -22,16 +22,16 @@ See the c++ class [std::list](https://en.cppreference.com/w/cpp/container/list)
## Header file and declaration
```c
-#define i_type // container type name (default: clist_{i_val})
-#define i_val // value: REQUIRED
-#define i_cmp // three-way compare two i_valraw* : REQUIRED IF i_valraw is a non-integral type
-#define i_valdrop // destroy value func - defaults to empty destruct
-#define i_valclone // REQUIRED IF i_valdrop defined
-
-#define i_valraw // convertion "raw" type (default: {i_val})
-#define i_valto // convertion func i_val* => i_valraw
-#define i_valfrom // convertion func i_valraw => i_val
-#define i_tag // alternative typename: cpque_{i_tag}. i_tag defaults to i_val
+#define i_type // container type name (default: clist_{i_key})
+#define i_key // value: REQUIRED
+#define i_cmp // three-way compare two i_keyraw* : REQUIRED IF i_keyraw is a non-integral type
+#define i_keydrop // destroy value func - defaults to empty destruct
+#define i_keyclone // REQUIRED IF i_keydrop defined
+
+#define i_keyraw // convertion "raw" type (default: {i_key})
+#define i_keyto // convertion func i_key* => i_keyraw
+#define i_keyfrom // convertion func i_keyraw => i_key
+#define i_tag // alternative typename: cpque_{i_tag}. i_tag defaults to i_key
#include <stc/clist.h>
```
@@ -53,31 +53,31 @@ intptr_t clist_X_count(const clist_X* list);
clist_X_value* clist_X_back(const clist_X* self);
clist_X_value* clist_X_front(const clist_X* self);
-void clist_X_push_back(clist_X* self, i_val value); // note: no pop_back()
-void clist_X_push_front(clist_X* self, i_val value);
-void clist_X_push(clist_X* self, i_val value); // alias for push_back()
+void clist_X_push_back(clist_X* self, i_key value); // note: no pop_back()
+void clist_X_push_front(clist_X* self, i_key value);
+void clist_X_push(clist_X* self, i_key value); // alias for push_back()
-void clist_X_emplace_back(clist_X* self, i_valraw raw);
-void clist_X_emplace_front(clist_X* self, i_valraw raw);
-void clist_X_emplace(clist_X* self, i_valraw raw); // alias for emplace_back()
+void clist_X_emplace_back(clist_X* self, i_keyraw raw);
+void clist_X_emplace_front(clist_X* self, i_keyraw raw);
+void clist_X_emplace(clist_X* self, i_keyraw raw); // alias for emplace_back()
-clist_X_iter clist_X_insert_at(clist_X* self, clist_X_iter it, i_val value); // return iter to new elem
-clist_X_iter clist_X_emplace_at(clist_X* self, clist_X_iter it, i_valraw raw);
+clist_X_iter clist_X_insert_at(clist_X* self, clist_X_iter it, i_key value); // return iter to new elem
+clist_X_iter clist_X_emplace_at(clist_X* self, clist_X_iter it, i_keyraw raw);
void clist_X_pop_front(clist_X* self);
clist_X_iter clist_X_erase_at(clist_X* self, clist_X_iter it); // return iter after it
clist_X_iter clist_X_erase_range(clist_X* self, clist_X_iter it1, clist_X_iter it2);
-intptr_t clist_X_remove(clist_X* self, i_valraw raw); // removes all matches
+intptr_t clist_X_remove(clist_X* self, i_keyraw raw); // removes all matches
clist_X clist_X_split_off(clist_X* self, clist_X_iter i1, clist_X_iter i2); // split off [i1, i2)
clist_X_iter clist_X_splice(clist_X* self, clist_X_iter it, clist_X* other); // return updated valid it
clist_X_iter clist_X_splice_range(clist_X* self, clist_X_iter it, // return updated valid it
clist_X* other, clist_X_iter it1, clist_X_iter it2);
-clist_X_iter clist_X_find(const clist_X* self, i_valraw raw);
-clist_X_iter clist_X_find_in(clist_X_iter it1, clist_X_iter it2, i_valraw raw);
-const i_val* clist_X_get(const clist_X* self, i_valraw raw);
-i_val* clist_X_get_mut(clist_X* self, i_valraw raw);
+clist_X_iter clist_X_find(const clist_X* self, i_keyraw raw);
+clist_X_iter clist_X_find_in(clist_X_iter it1, clist_X_iter it2, i_keyraw raw);
+const i_key* clist_X_get(const clist_X* self, i_keyraw raw);
+i_key* clist_X_get_mut(clist_X* self, i_keyraw raw);
void clist_X_reverse(clist_X* self);
void clist_X_sort(clist_X* self);
@@ -108,8 +108,8 @@ void clist_X_value_drop(clist_X_value* pval);
|:--------------------|:------------------------------------|:-----------------------------------------|
| `clist_X` | `struct { clist_X_node* last; }` | The clist type |
| `clist_X_node` | `struct { clist_X_node* next; clist_X_value value; }` | The clist node type |
-| `clist_X_value` | `i_val` | The clist element type |
-| `clist_X_raw` | `i_valraw` | clist raw value type |
+| `clist_X_value` | `i_key` | The clist element type |
+| `clist_X_raw` | `i_keyraw` | clist raw value type |
| `clist_X_iter` | `struct { clist_value *ref; ... }` | clist iterator |
## Example
@@ -117,7 +117,7 @@ void clist_X_value_drop(clist_X_value* pval);
Interleave *push_front()* / *push_back()* then *sort()*:
```c
#define i_type DList
-#define i_val double
+#define i_key double
#include <stc/clist.h>
#include <stdio.h>
@@ -154,7 +154,7 @@ Use of *erase_at()* and *erase_range()*:
```c
// erasing from clist
#define i_tag i
-#define i_val int
+#define i_key int
#include <stc/clist.h>
#include <stdio.h>
@@ -189,7 +189,7 @@ mylist contains: 10 30
Splice `[30, 40]` from *L2* into *L1* before `3`:
```c
#define i_tag i
-#define i_val int
+#define i_key int
#include <stc/clist.h>
#include <stdio.h>
diff --git a/docs/cpque_api.md b/docs/cpque_api.md
index 962ee162..ca94e367 100644
--- a/docs/cpque_api.md
+++ b/docs/cpque_api.md
@@ -8,17 +8,17 @@ See the c++ class [std::priority_queue](https://en.cppreference.com/w/cpp/contai
## Header file and declaration
```c
-#define i_type // define type name of the container (default cpque_{i_val})
-#define i_val // value: REQUIRED
-#define i_less // compare two i_val* : REQUIRED IF i_val/i_valraw is a non-integral type
-#define i_valdrop // destroy value func - defaults to empty destruct
-#define i_valclone // REQUIRED IF i_valdrop defined
+#define i_type // define type name of the container (default cpque_{i_key})
+#define i_key // value: REQUIRED
+#define i_less // compare two i_key* : REQUIRED IF i_key/i_keyraw is a non-integral type
+#define i_keydrop // destroy value func - defaults to empty destruct
+#define i_keyclone // REQUIRED IF i_keydrop defined
-#define i_valraw // convertion type
-#define i_valfrom // convertion func i_valraw => i_val
-#define i_valto // convertion func i_val* => i_valraw.
+#define i_keyraw // convertion type
+#define i_keyfrom // convertion func i_keyraw => i_key
+#define i_keyto // convertion func i_key* => i_keyraw.
-#define i_tag // alternative typename: cpque_{i_tag}. i_tag defaults to i_val
+#define i_tag // alternative typename: cpque_{i_tag}. i_tag defaults to i_key
#include <stc/cpque.h>
```
`X` should be replaced by the value of `i_tag` in all of the following documentation.
@@ -28,7 +28,7 @@ See the c++ class [std::priority_queue](https://en.cppreference.com/w/cpp/contai
```c
cpque_X cpque_X_init(void); // create empty pri-queue.
cpque_X cpque_X_with_capacity(intptr_t cap);
-cpque_X cpque_X_with_size(intptr_t size, i_val null);
+cpque_X cpque_X_with_size(intptr_t size, i_key null);
cpque_X cpque_X_clone(cpque_X pq);
void cpque_X_clear(cpque_X* self);
@@ -39,16 +39,16 @@ void cpque_X_drop(cpque_X* self); // destructor
intptr_t cpque_X_size(const cpque_X* self);
bool cpque_X_empty(const cpque_X* self);
-i_val* cpque_X_top(const cpque_X* self);
+i_key* cpque_X_top(const cpque_X* self);
void cpque_X_make_heap(cpque_X* self); // heapify the vector.
-void cpque_X_push(cpque_X* self, i_val value);
-void cpque_X_emplace(cpque_X* self, i_valraw raw); // converts from raw
+void cpque_X_push(cpque_X* self, i_key value);
+void cpque_X_emplace(cpque_X* self, i_keyraw raw); // converts from raw
void cpque_X_pop(cpque_X* self);
void cpque_X_erase_at(cpque_X* self, intptr_t idx);
-i_val cpque_X_value_clone(i_val value);
+i_key cpque_X_value_clone(i_key value);
```
## Types
@@ -56,14 +56,14 @@ i_val cpque_X_value_clone(i_val value);
| Type name | Type definition | Used to represent... |
|:-------------------|:--------------------------------------|:------------------------|
| `cpque_X` | `struct {cpque_X_value* data; ...}` | The cpque type |
-| `cpque_X_value` | `i_val` | The cpque element type |
+| `cpque_X_value` | `i_key` | The cpque element type |
## Example
```c
#include <stc/crand.h>
#include <stdio.h>
-#define i_val int64_t
+#define i_key int64_t
#define i_cmp -c_default_cmp // min-heap
#define i_tag i
#include <stc/cpque.h>
diff --git a/docs/cqueue_api.md b/docs/cqueue_api.md
index f5df86d6..bce62833 100644
--- a/docs/cqueue_api.md
+++ b/docs/cqueue_api.md
@@ -7,16 +7,16 @@ See the c++ class [std::queue](https://en.cppreference.com/w/cpp/container/queue
## Header file and declaration
```c
-#define i_type // container type name (default: cset_{i_key})
-#define i_val // value: REQUIRED
-#define i_valdrop // destroy value func - defaults to empty destruct
-#define i_valclone // REQUIRED IF i_valdrop defined
+#define i_type // container type name (default: cqueue_{i_key})
+#define i_key // value: REQUIRED
+#define i_keydrop // destroy value func - defaults to empty destruct
+#define i_keyclone // REQUIRED IF i_keydrop defined
-#define i_valraw // convertion "raw" type - defaults to i_val
-#define i_valfrom // convertion func i_valraw => i_val
-#define i_valto // convertion func i_val* => i_valraw
+#define i_keyraw // convertion "raw" type - defaults to i_key
+#define i_keyfrom // convertion func i_keyraw => i_key
+#define i_keyto // convertion func i_key* => i_keyraw
-#define i_tag // alternative typename: cqueue_{i_tag}. i_tag defaults to i_val
+#define i_tag // alternative typename: cqueue_{i_tag}. i_tag defaults to i_key
#include <stc/cqueue.h>
```
`X` should be replaced by the value of `i_tag` in all of the following documentation.
@@ -42,8 +42,8 @@ bool cqueue_X_empty(const cqueue_X* self);
cqueue_X_value* cqueue_X_front(const cqueue_X* self);
cqueue_X_value* cqueue_X_back(const cqueue_X* self);
-cqueue_X_value* cqueue_X_push(cqueue_X* self, i_val value);
-cqueue_X_value* cqueue_X_emplace(cqueue_X* self, i_valraw raw);
+cqueue_X_value* cqueue_X_push(cqueue_X* self, i_key value);
+cqueue_X_value* cqueue_X_emplace(cqueue_X* self, i_keyraw raw);
void cqueue_X_pop(cqueue_X* self);
cqueue_X_iter cqueue_X_begin(const cqueue_X* self);
@@ -52,7 +52,7 @@ void cqueue_X_next(cqueue_X_iter* it);
cqueue_X_iter cqueue_X_advance(cqueue_X_iter it, intptr_t n);
bool cqueue_X_eq(const cqueue_X* c1, const cqueue_X* c2); // require i_eq/i_cmp/i_less.
-i_val cqueue_X_value_clone(i_val value);
+i_key cqueue_X_value_clone(i_key value);
cqueue_X_raw cqueue_X_value_toraw(const cqueue_X_value* pval);
void cqueue_X_value_drop(cqueue_X_value* pval);
```
@@ -62,13 +62,13 @@ void cqueue_X_value_drop(cqueue_X_value* pval);
| Type name | Type definition | Used to represent... |
|:--------------------|:---------------------|:-------------------------|
| `cqueue_X` | `cdeq_X` | The cqueue type |
-| `cqueue_X_value` | `i_val` | The cqueue element type |
-| `cqueue_X_raw` | `i_valraw` | cqueue raw value type |
+| `cqueue_X_value` | `i_key` | The cqueue element type |
+| `cqueue_X_raw` | `i_keyraw` | cqueue raw value type |
| `cqueue_X_iter` | `cdeq_X_iter` | cqueue iterator |
## Examples
```c
-#define i_val int
+#define i_key int
#define i_tag i
#include <stc/cqueue.h>
diff --git a/docs/cset_api.md b/docs/cset_api.md
index ecf87e5b..7bce3136 100644
--- a/docs/cset_api.md
+++ b/docs/cset_api.md
@@ -18,7 +18,7 @@ A **cset** is an associative container that contains a set of unique objects of
#define i_keyfrom // convertion func i_keyraw => i_key - defaults to plain copy
#define i_keyto // convertion func i_key* => i_keyraw - defaults to plain copy
-#define i_tag // alternative typename: cmap_{i_tag}. i_tag defaults to i_val
+#define i_tag // alternative typename: cmap_{i_tag}. i_tag defaults to i_key
#define i_expandby // default 1. If 2, table expand 2x (else 1.5x)
#include <stc/cset.h>
```
diff --git a/docs/cspan_api.md b/docs/cspan_api.md
index 4262b1ef..1aeeb4f7 100644
--- a/docs/cspan_api.md
+++ b/docs/cspan_api.md
@@ -47,8 +47,11 @@ SpanTypeN_iter SpanType_begin(const SpanTypeN* self);
SpanTypeN_iter SpanType_end(const SpanTypeN* self);
void SpanType_next(SpanTypeN_iter* it);
-SpanTypeN cspan_md(char order, ValueType* data, d1, d2, ...); // make a multi-dim cspan. order: 'C' or 'F' (Fortran)
- // transpose the md span (inverse axes). no changes to the underlying array.
+SpanTypeN cspan_md(ValueType* data, d1, d2, ...); // make a multi-dim cspan, row-major order.
+SpanTypeN cspan_md_left(ValueType* data, d1, d2, ...); // column-major ordered cspan (layout left).
+SpanTypeN cspan_md_ordered(char order, ValueType* data, d1, d2, ...); // order='C': row-major, 'F' (Fortran): column-major.
+
+ // transpose a md span (inverse axes). no changes to the underlying array.
void cspan_transpose(const SpanTypeN* self);
// create a sub md span of lower rank. Like e.g. cspan_slice(Span2, &ms4, {x}, {y}, {c_ALL}, {c_ALL});
diff --git a/docs/csset_api.md b/docs/csset_api.md
index 5695ecf6..d086b660 100644
--- a/docs/csset_api.md
+++ b/docs/csset_api.md
@@ -18,7 +18,7 @@ See the c++ class [std::set](https://en.cppreference.com/w/cpp/container/set) fo
#define i_keyfrom // convertion func i_keyraw => i_key - defaults to plain copy
#define i_keyto // convertion func i_key* => i_keyraw - defaults to plain copy
-#define i_tag // alternative typename: csset_{i_tag}. i_tag defaults to i_val
+#define i_tag // alternative typename: csset_{i_tag}. i_tag defaults to i_key
#include <stc/csset.h>
```
`X` should be replaced by the value of `i_tag` in all of the following documentation.
diff --git a/docs/cstack_api.md b/docs/cstack_api.md
index 9cb7b42b..51889d7f 100644
--- a/docs/cstack_api.md
+++ b/docs/cstack_api.md
@@ -9,15 +9,15 @@ See the c++ class [std::stack](https://en.cppreference.com/w/cpp/container/stack
```c
#define i_type // full typename of the container
-#define i_val // value: REQUIRED
-#define i_valdrop // destroy value func - defaults to empty destruct
-#define i_valclone // REQUIRED IF i_valdrop defined
+#define i_key // value: REQUIRED
+#define i_keydrop // destroy value func - defaults to empty destruct
+#define i_keyclone // REQUIRED IF i_keydrop defined
-#define i_valraw // convertion "raw" type - defaults to i_val
-#define i_valfrom // convertion func i_valraw => i_val
-#define i_valto // convertion func i_val* => i_valraw
+#define i_keyraw // convertion "raw" type - defaults to i_key
+#define i_keyfrom // convertion func i_keyraw => i_key
+#define i_keyto // convertion func i_key* => i_keyraw
-#define i_tag // alternative typename: cstack_{i_tag}. i_tag defaults to i_val
+#define i_tag // alternative typename: cstack_{i_tag}. i_tag defaults to i_key
#include <stc/cstack.h>
```
`X` should be replaced by the value of `i_tag` in all of the following documentation.
@@ -27,13 +27,13 @@ See the c++ class [std::stack](https://en.cppreference.com/w/cpp/container/stack
```c
cstack_X cstack_X_init(void);
cstack_X cstack_X_with_capacity(intptr_t cap);
-cstack_X cstack_X_with_size(intptr_t size, i_val fill);
+cstack_X cstack_X_with_size(intptr_t size, i_key fill);
cstack_X cstack_X_clone(cstack_X st);
void cstack_X_clear(cstack_X* self);
bool cstack_X_reserve(cstack_X* self, intptr_t n);
void cstack_X_shrink_to_fit(cstack_X* self);
-i_val* cstack_X_append_uninit(cstack_X* self, intptr_t n);
+i_key* cstack_X_append_uninit(cstack_X* self, intptr_t n);
void cstack_X_copy(cstack_X* self, const cstack_X* other);
void cstack_X_drop(cstack_X* self); // destructor
@@ -41,12 +41,12 @@ intptr_t cstack_X_size(const cstack_X* self);
intptr_t cstack_X_capacity(const cstack_X* self);
bool cstack_X_empty(const cstack_X* self);
-i_val* cstack_X_top(const cstack_X* self);
-const i_val* cstack_X_at(const cstack_X* self, intptr_t idx);
-i_val* cstack_X_at_mut(cstack_X* self, intptr_t idx);
+i_key* cstack_X_top(const cstack_X* self);
+const i_key* cstack_X_at(const cstack_X* self, intptr_t idx);
+i_key* cstack_X_at_mut(cstack_X* self, intptr_t idx);
-i_val* cstack_X_push(cstack_X* self, i_val value);
-i_val* cstack_X_emplace(cstack_X* self, i_valraw raw);
+i_key* cstack_X_push(cstack_X* self, i_key value);
+i_key* cstack_X_emplace(cstack_X* self, i_keyraw raw);
void cstack_X_pop(cstack_X* self);
@@ -55,8 +55,8 @@ cstack_X_iter cstack_X_end(const cstack_X* self);
void cstack_X_next(cstack_X_iter* it);
bool cstack_X_eq(const cstack_X* c1, const cstack_X* c2); // require i_eq/i_cmp/i_less.
-i_val cstack_X_value_clone(i_val value);
-i_valraw cstack_X_value_toraw(const cvec_X_value* pval);
+i_key cstack_X_value_clone(i_key value);
+i_keyraw cstack_X_value_toraw(const cvec_X_value* pval);
void cstack_X_value_drop(cvec_X_value* pval);
```
@@ -65,14 +65,14 @@ void cstack_X_value_drop(cvec_X_value* pval);
| Type name | Type definition | Used to represent... |
|:--------------------|:-------------------------------------|:----------------------------|
| `cstack_X` | `struct { cstack_value *data; ... }` | The cstack type |
-| `cstack_X_value` | `i_val` | The cstack element type |
-| `cstack_X_raw` | `i_valraw` | cstack raw value type |
+| `cstack_X_value` | `i_key` | The cstack element type |
+| `cstack_X_raw` | `i_keyraw` | cstack raw value type |
| `cstack_X_iter` | `struct { cstack_value *ref; }` | cstack iterator |
## Example
```c
#define i_type IStack
-#define i_val int
+#define i_key int
#include <stc/cstack.h>
#include <stdio.h>
diff --git a/docs/csview_api.md b/docs/csview_api.md
index a02b007a..33df6a64 100644
--- a/docs/csview_api.md
+++ b/docs/csview_api.md
@@ -185,7 +185,7 @@ void print_split(csview input, const char* sep)
}
#define i_implement
#include <stc/cstr.h>
-#define i_val_str
+#define i_key_str
#include <stc/cstack.h>
cstack_str string_split(csview input, const char* sep)
diff --git a/docs/cvec_api.md b/docs/cvec_api.md
index d19f4bae..ce85e446 100644
--- a/docs/cvec_api.md
+++ b/docs/cvec_api.md
@@ -13,16 +13,16 @@ See the c++ class [std::vector](https://en.cppreference.com/w/cpp/container/vect
```c
#define i_type // full typename of the container
-#define i_val // value: REQUIRED
-#define i_cmp // three-way compare two i_valraw* : REQUIRED IF i_valraw is a non-integral type
-#define i_valdrop // destroy value func - defaults to empty destruct
-#define i_valclone // REQUIRED IF i_valdrop defined
+#define i_key // value: REQUIRED
+#define i_cmp // three-way compare two i_keyraw* : REQUIRED IF i_keyraw is a non-integral type
+#define i_keydrop // destroy value func - defaults to empty destruct
+#define i_keyclone // REQUIRED IF i_keydrop defined
-#define i_valraw // convertion "raw" type - defaults to i_val
-#define i_valfrom // convertion func i_valraw => i_val
-#define i_valto // convertion func i_val* => i_valraw
+#define i_keyraw // convertion "raw" type - defaults to i_key
+#define i_keyfrom // convertion func i_keyraw => i_key
+#define i_keyto // convertion func i_key* => i_keyraw
-#define i_tag // alternative typename: cvec_{i_tag}. i_tag defaults to i_val
+#define i_tag // alternative typename: cvec_{i_tag}. i_tag defaults to i_key
#include <stc/cvec.h>
```
`X` should be replaced by the value of `i_tag` in all of the following documentation.
@@ -31,15 +31,15 @@ See the c++ class [std::vector](https://en.cppreference.com/w/cpp/container/vect
```c
cvec_X cvec_X_init(void);
-cvec_X cvec_X_with_size(intptr_t size, i_val null);
+cvec_X cvec_X_with_size(intptr_t size, i_key null);
cvec_X cvec_X_with_capacity(intptr_t size);
cvec_X cvec_X_clone(cvec_X vec);
void cvec_X_clear(cvec_X* self);
void cvec_X_copy(cvec_X* self, const cvec_X* other);
-cvec_X_iter cvec_X_copy_n(cvec_X* self, intptr_t idx, const i_val* arr, intptr_t n);
+cvec_X_iter cvec_X_copy_n(cvec_X* self, intptr_t idx, const i_key* arr, intptr_t n);
bool cvec_X_reserve(cvec_X* self, intptr_t cap);
-bool cvec_X_resize(cvec_X* self, intptr_t size, i_val null);
+bool cvec_X_resize(cvec_X* self, intptr_t size, i_key null);
void cvec_X_shrink_to_fit(cvec_X* self);
void cvec_X_drop(cvec_X* self); // destructor
@@ -48,34 +48,34 @@ intptr_t cvec_X_size(const cvec_X* self);
intptr_t cvec_X_capacity(const cvec_X* self);
const cvec_X_value* cvec_X_at(const cvec_X* self, intptr_t idx);
-const cvec_X_value* cvec_X_get(const cvec_X* self, i_valraw raw); // return NULL if not found
+const cvec_X_value* cvec_X_get(const cvec_X* self, i_keyraw raw); // return NULL if not found
cvec_X_value* cvec_X_at_mut(cvec_X* self, intptr_t idx); // return mutable at idx
-cvec_X_value* cvec_X_get_mut(cvec_X* self, i_valraw raw); // find mutable value
-cvec_X_iter cvec_X_find(const cvec_X* self, i_valraw raw);
-cvec_X_iter cvec_X_find_in(cvec_X_iter i1, cvec_X_iter i2, i_valraw raw); // return cvec_X_end() if not found
+cvec_X_value* cvec_X_get_mut(cvec_X* self, i_keyraw raw); // find mutable value
+cvec_X_iter cvec_X_find(const cvec_X* self, i_keyraw raw);
+cvec_X_iter cvec_X_find_in(cvec_X_iter i1, cvec_X_iter i2, i_keyraw raw); // return cvec_X_end() if not found
// On sorted vectors:
-cvec_X_iter cvec_X_binary_search(const cvec_X* self, i_valraw raw); // at elem == raw, else end
-cvec_X_iter cvec_X_lower_bound(const cvec_X* self, i_valraw raw); // at first elem >= raw, else end
+cvec_X_iter cvec_X_binary_search(const cvec_X* self, i_keyraw raw); // at elem == raw, else end
+cvec_X_iter cvec_X_lower_bound(const cvec_X* self, i_keyraw raw); // at first elem >= raw, else end
cvec_X_iter cvec_X_binary_search_in(cvec_X_iter i1, cvec_X_iter i2,
- i_valraw raw, cvec_X_iter* lower_bound);
+ i_keyraw raw, cvec_X_iter* lower_bound);
cvec_X_value* cvec_X_front(const cvec_X* self);
cvec_X_value* cvec_X_back(const cvec_X* self);
-cvec_X_value* cvec_X_push(cvec_X* self, i_val value);
-cvec_X_value* cvec_X_emplace(cvec_X* self, i_valraw raw);
-cvec_X_value* cvec_X_push_back(cvec_X* self, i_val value); // alias for push
-cvec_X_value* cvec_X_emplace_back(cvec_X* self, i_valraw raw); // alias for emplace
+cvec_X_value* cvec_X_push(cvec_X* self, i_key value);
+cvec_X_value* cvec_X_emplace(cvec_X* self, i_keyraw raw);
+cvec_X_value* cvec_X_push_back(cvec_X* self, i_key value); // alias for push
+cvec_X_value* cvec_X_emplace_back(cvec_X* self, i_keyraw raw); // alias for emplace
void cvec_X_pop(cvec_X* self);
void cvec_X_pop_back(cvec_X* self); // alias for pop
-cvec_X_iter cvec_X_insert_n(cvec_X* self, intptr_t idx, const i_val arr[], intptr_t n); // move values
-cvec_X_iter cvec_X_insert_at(cvec_X* self, cvec_X_iter it, i_val value); // move value
+cvec_X_iter cvec_X_insert_n(cvec_X* self, intptr_t idx, const i_key arr[], intptr_t n); // move values
+cvec_X_iter cvec_X_insert_at(cvec_X* self, cvec_X_iter it, i_key value); // move value
cvec_X_iter cvec_X_insert_uninit(cvec_X* self, intptr_t idx, intptr_t n); // return iter at idx
-cvec_X_iter cvec_X_emplace_n(cvec_X* self, intptr_t idx, const i_valraw raw[], intptr_t n);
-cvec_X_iter cvec_X_emplace_at(cvec_X* self, cvec_X_iter it, i_valraw raw);
+cvec_X_iter cvec_X_emplace_n(cvec_X* self, intptr_t idx, const i_keyraw raw[], intptr_t n);
+cvec_X_iter cvec_X_emplace_at(cvec_X* self, cvec_X_iter it, i_keyraw raw);
cvec_X_iter cvec_X_erase_n(cvec_X* self, intptr_t idx, intptr_t n);
cvec_X_iter cvec_X_erase_at(cvec_X* self, cvec_X_iter it);
@@ -83,7 +83,7 @@ cvec_X_iter cvec_X_erase_range(cvec_X* self, cvec_X_iter it1, cvec_X_ite
void cvec_X_sort(cvec_X* self);
void cvec_X_sort_range(cvec_X_iter i1, cvec_X_iter i2,
- int(*cmp)(const i_val*, const i_val*));
+ int(*cmp)(const i_key*, const i_key*));
cvec_X_iter cvec_X_begin(const cvec_X* self);
cvec_X_iter cvec_X_end(const cvec_X* self);
@@ -101,13 +101,13 @@ cvec_X_raw cvec_X_value_drop(cvec_X_value* pval);
| Type name | Type definition | Used to represent... |
|:-------------------|:----------------------------------|:-----------------------|
| `cvec_X` | `struct { cvec_X_value* data; }` | The cvec type |
-| `cvec_X_value` | `i_val` | The cvec value type |
-| `cvec_X_raw` | `i_valraw` | The raw value type |
+| `cvec_X_value` | `i_key` | The cvec value type |
+| `cvec_X_raw` | `i_keyraw` | The raw value type |
| `cvec_X_iter` | `struct { cvec_X_value* ref; }` | The iterator type |
## Examples
```c
-#define i_val int
+#define i_key int
#include <stc/cvec.h>
#include <stdio.h>
@@ -150,7 +150,7 @@ sorted: 5 7 8 13 16 25
#define i_implement
#include <stc/cstr.h>
-#define i_val_str
+#define i_key_str
#include <stc/cvec.h>
int main() {
@@ -206,7 +206,7 @@ User User_clone(User user) {
// Declare a managed, clonable vector of users.
#define i_type UVec
-#define i_valclass User // User is a "class" as it has _cmp, _clone and _drop functions.
+#define i_keyclass User // User is a "class" as it has _cmp, _clone and _drop functions.
#include <stc/cvec.h>
int main(void) {