summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2022-04-18 12:12:01 +0200
committerTyge Lovset <[email protected]>2022-04-18 12:12:01 +0200
commitb0d60c33a073782fe0bb08c835ca9db0b94145d0 (patch)
tree1683369ec66467720502b3d904bf9ab11343076e /docs
parent00804d9ff488f63468a0bb528c7b807aea7c3ea3 (diff)
downloadSTC-modified-b0d60c33a073782fe0bb08c835ca9db0b94145d0.tar.gz
STC-modified-b0d60c33a073782fe0bb08c835ca9db0b94145d0.zip
Removed i_drop and i_from template specifiers to reduce redundancies and add clarity (error given if used): use i_valdrop/i_valfrom and i_keydrop/i_keyfrom instead.
Added missing at_mut() function to cdeq.
Diffstat (limited to 'docs')
-rw-r--r--docs/carc_api.md6
-rw-r--r--docs/carray_api.md4
-rw-r--r--docs/cbox_api.md15
-rw-r--r--docs/cdeq_api.md2
-rw-r--r--docs/clist_api.md4
-rw-r--r--docs/cmap_api.md2
-rw-r--r--docs/cpque_api.md2
-rw-r--r--docs/cqueue_api.md2
-rw-r--r--docs/cset_api.md2
-rw-r--r--docs/csset_api.md2
-rw-r--r--docs/cstack_api.md2
-rw-r--r--docs/cvec_api.md8
12 files changed, 26 insertions, 25 deletions
diff --git a/docs/carc_api.md b/docs/carc_api.md
index c137094d..8fb752f6 100644
--- a/docs/carc_api.md
+++ b/docs/carc_api.md
@@ -27,7 +27,7 @@ See similar c++ class [std::shared_ptr](https://en.cppreference.com/w/cpp/memory
```c
#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_drop // destroy value func - defaults to empty destruct
+#define i_valdrop // destroy value func - defaults to empty destruct
#define i_tag // defaults to i_val
#define i_opt c_no_atomic // Non-atomic reference counting, like Rust Rc.
#include <stc/carc.h>
@@ -80,8 +80,8 @@ bool carc_X_value_eq(const i_val* x, const i_val* y); // cbox_X_value_c
#define i_type Arc // (atomic) ref. counted type
#define i_val Map
-#define i_from Map_clone
-#define i_drop(p) (printf("drop Arc:\n"), Map_drop(p))
+#define i_valfrom Map_clone
+#define i_valdrop(p) (printf("drop Arc:\n"), Map_drop(p))
// no comparison of Maps needed (or available), and
// no need for atomic ref. count in single thread:
#define i_opt c_no_cmp|c_no_atomic
diff --git a/docs/carray_api.md b/docs/carray_api.md
index 3ac6d650..8c63f381 100644
--- a/docs/carray_api.md
+++ b/docs/carray_api.md
@@ -10,8 +10,8 @@ See the c++ class [boost::multi_array](https://www.boost.org/doc/libs/release/li
```c
#define i_val // value: REQUIRED
-#define i_drop // destroy value func - defaults to empty destruct
-#define i_from // func Raw => i_val - defaults to plain copy
+#define i_valdrop // destroy value func - defaults to empty destruct
+#define i_valfrom // func Raw => i_val - defaults to plain copy
#define i_valto // func i_val => Raw - defaults to plain copy
#define i_tag // defaults to i_val
diff --git a/docs/cbox_api.md b/docs/cbox_api.md
index fe23fa8a..0faea829 100644
--- a/docs/cbox_api.md
+++ b/docs/cbox_api.md
@@ -5,8 +5,8 @@ be empty. The *cbox_X_cmp()*, *cbox_X_drop()* methods are defined based on the `
and `i_valdrop` macros specified. Use *cbox_X_clone(p)* to make a deep copy, which uses the
`i_valfrom` macro if defined.
-When declaring a container of **cbox** values, it is recommended to define `i_val_bind` to the
-cbox type instead of defining `i_val`. This will auto-set `i_drop`, `i_from`, and `i_cmp` using
+When declaring a container of **cbox** values, define `i_val_arcbox` with the
+cbox type instead of defining `i_val`. This will auto-set `i_valdrop`, `i_valfrom`, and `i_cmp` using
functions defined by the specified **cbox**.
For containers, make sure to pass the result of create functions like *cbox_X_new()* **only** to
@@ -20,9 +20,9 @@ See similar c++ class [std::unique_ptr](https://en.cppreference.com/w/cpp/memory
```c
#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_drop // destroy value func - defaults to empty destruct
+#define i_valdrop // destroy value func - defaults to empty destruct
#define i_valraw // convertion type
-#define i_from // create from raw/clone func - REQUIRED if i_drop is defined,
+#define i_valfrom // create from raw/clone func - REQUIRED if i_valdrop is defined,
// unless 'i_opt c_no_clone' is defined.
#define i_valto // to-raw func.
#define i_tag // type name tag, defaults to i_val
@@ -72,8 +72,8 @@ void int_drop(int* x) {
#define i_type IBox
#define i_val int
-#define i_drop int_drop // optional func, just to display elements destroyed
-#define i_from c_default_from // must specify because i_drop was defined.
+#define i_valdrop int_drop // optional func, just to display elements destroyed
+#define i_valfrom c_default_from // must specify because i_valdrop was defined.
#include <stc/cbox.h>
#define i_type ISet
@@ -90,7 +90,8 @@ int main()
c_auto (ISet, set) // similar
{
c_apply(v, IVec_push(&vec, v), IBox, {
- IBox_from(2021), IBox_from(2012), IBox_from(2022), IBox_from(2015),
+ IBox_from(2021), IBox_from(2012),
+ IBox_from(2022), IBox_from(2015),
});
printf("vec:");
diff --git a/docs/cdeq_api.md b/docs/cdeq_api.md
index 69a40986..3cd4fece 100644
--- a/docs/cdeq_api.md
+++ b/docs/cdeq_api.md
@@ -10,7 +10,7 @@ See the c++ class [std::deque](https://en.cppreference.com/w/cpp/container/deque
```c
#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_drop // destroy value func - defaults to empty destruct
+#define i_valdrop // destroy value func - defaults to empty destruct
#define i_valraw // convertion "raw" type - defaults to i_val
#define i_valfrom // convertion func i_valraw => i_val - defaults to plain copy
#define i_valto // convertion func i_val* => i_valraw - defaults to plain copy
diff --git a/docs/clist_api.md b/docs/clist_api.md
index 549cdd9f..cae3e66b 100644
--- a/docs/clist_api.md
+++ b/docs/clist_api.md
@@ -24,10 +24,10 @@ See the c++ class [std::list](https://en.cppreference.com/w/cpp/container/list)
```c
#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_drop // destroy value func - defaults to empty destruct
+#define i_valdrop // destroy value func - defaults to empty destruct
#define i_valraw // convertion "raw" type - defaults to i_val
#define i_valto // convertion func i_val* => i_valraw - defaults to plain copy
-#define i_from // convertion func i_valraw => i_val - defaults to plain copy
+#define i_valfrom // convertion func i_valraw => i_val - defaults to plain copy
#define i_tag // defaults to i_val
#include <stc/clist.h>
```
diff --git a/docs/cmap_api.md b/docs/cmap_api.md
index 69d3d6db..77577bd7 100644
--- a/docs/cmap_api.md
+++ b/docs/cmap_api.md
@@ -301,7 +301,7 @@ static inline void Viking_drop(Viking* vk) {
// #define i_eq Viking_eq
// #define i_hash Viking_hash
// #define i_keyfrom Viking_clone
-// #define i_drop Viking_drop
+// #define i_keydrop Viking_drop
#include <stc/cmap.h>
int main()
diff --git a/docs/cpque_api.md b/docs/cpque_api.md
index 97ac70f5..c6a0fc50 100644
--- a/docs/cpque_api.md
+++ b/docs/cpque_api.md
@@ -12,7 +12,7 @@ See the c++ class [std::priority_queue](https://en.cppreference.com/w/cpp/contai
```c
#define i_val // value: REQUIRED
#define i_cmp // three-way compare two i_val* : REQUIRED IF i_val/i_valraw is a non-integral type
-#define i_drop // destroy value func - defaults to empty destruct
+#define i_valdrop // destroy value func - defaults to empty destruct
#define i_valraw // convertion type
#define i_valfrom // convertion func i_valraw => i_val - defaults to plain copy
#define i_valto // convertion func i_val* => i_valraw.
diff --git a/docs/cqueue_api.md b/docs/cqueue_api.md
index 0ecae014..bff0b5ce 100644
--- a/docs/cqueue_api.md
+++ b/docs/cqueue_api.md
@@ -9,7 +9,7 @@ See the c++ class [std::queue](https://en.cppreference.com/w/cpp/container/queue
```c
#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_drop // destroy value func - defaults to empty destruct
+#define i_valdrop // destroy value func - defaults to empty destruct
#define i_valraw // convertion "raw" type - defaults to i_val
#define i_valfrom // convertion func i_valraw => i_val - defaults to plain copy
#define i_valto // convertion func i_val* => i_valraw - defaults to plain copy
diff --git a/docs/cset_api.md b/docs/cset_api.md
index 4d97b94f..e429c5ae 100644
--- a/docs/cset_api.md
+++ b/docs/cset_api.md
@@ -10,7 +10,7 @@ A **cset** is an associative container that contains a set of unique objects of
#define i_key // hash key: REQUIRED.
#define i_hash // hash func: REQUIRED IF i_keyraw is a non-pod type.
#define i_eq // equality comparison two i_keyraw*: !i_cmp will be used if not defined.
-#define i_drop // destroy key func - defaults to empty destruct
+#define i_valdrop // destroy key func - defaults to empty destruct
#define i_keyraw // convertion "raw" type - defaults to i_key
#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
diff --git a/docs/csset_api.md b/docs/csset_api.md
index 76b26eee..0ce8e811 100644
--- a/docs/csset_api.md
+++ b/docs/csset_api.md
@@ -10,7 +10,7 @@ See the c++ class [std::set](https://en.cppreference.com/w/cpp/container/set) fo
```c
#define i_key // key: REQUIRED
#define i_cmp // three-way compare two i_keyraw* : REQUIRED IF i_keyraw is a non-integral type
-#define i_drop // destroy key func - defaults to empty destruct
+#define i_valdrop // destroy key func - defaults to empty destruct
#define i_keyraw // convertion "raw" type - defaults to i_key
#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
diff --git a/docs/cstack_api.md b/docs/cstack_api.md
index 299ea1c6..8fc5fe8b 100644
--- a/docs/cstack_api.md
+++ b/docs/cstack_api.md
@@ -10,7 +10,7 @@ See the c++ class [std::stack](https://en.cppreference.com/w/cpp/container/stack
```c
#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_drop // destroy value func - defaults to empty destruct
+#define i_valdrop // destroy value func - defaults to empty destruct
#define i_valraw // convertion "raw" type - defaults to i_val
#define i_valfrom // convertion func i_valraw => i_val - defaults to plain copy
#define i_valto // convertion func i_val* => i_valraw - defaults to plain copy
diff --git a/docs/cvec_api.md b/docs/cvec_api.md
index 660f7a67..e02a944e 100644
--- a/docs/cvec_api.md
+++ b/docs/cvec_api.md
@@ -14,7 +14,7 @@ See the c++ class [std::vector](https://en.cppreference.com/w/cpp/container/vect
```c
#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_drop // destroy value func - defaults to empty destruct
+#define i_valdrop // destroy value func - defaults to empty destruct
#define i_valraw // convertion "raw" type - defaults to i_val
#define i_valfrom // convertion func i_valraw => i_val - defaults to plain copy
#define i_valto // convertion func i_val* => i_valraw - defaults to plain copy
@@ -23,7 +23,7 @@ See the c++ class [std::vector](https://en.cppreference.com/w/cpp/container/vect
```
`X` should be replaced by the value of `i_tag` in all of the following documentation.
-`i_drop` may be defined instead of `i_valdrop` (or `i_keydrop`) for all non-map containers.
+`i_valdrop` may be defined instead of `i_valdrop` (or `i_keydrop`) for all non-map containers.
## Methods
@@ -202,8 +202,8 @@ User User_clone(User user) {
// Note that cvec_u_emplace_back() will clone input:
#define i_val User
#define i_cmp User_cmp
-#define i_drop User_drop
-#define i_from User_clone
+#define i_valdrop User_drop
+#define i_valfrom User_clone
#define i_tag u
#include <stc/cvec.h>