summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-12-15 10:45:22 +0100
committerTyge Løvset <[email protected]>2021-12-15 10:45:22 +0100
commit7f264be520123c71211967a56d2826d272694edf (patch)
tree6afcd2ccf5ffb24fcaa2ef0be46434721b567549 /docs
parenta2671650430bf12304bead0bc9f23903f03db8a6 (diff)
downloadSTC-modified-7f264be520123c71211967a56d2826d272694edf.tar.gz
STC-modified-7f264be520123c71211967a56d2826d272694edf.zip
Some improvements in cvec and cpque.
Diffstat (limited to 'docs')
-rw-r--r--docs/cpque_api.md11
-rw-r--r--docs/cvec_api.md4
2 files changed, 7 insertions, 8 deletions
diff --git a/docs/cpque_api.md b/docs/cpque_api.md
index ddc0532c..5c0c9ec4 100644
--- a/docs/cpque_api.md
+++ b/docs/cpque_api.md
@@ -3,17 +3,17 @@
A priority queue is a container adaptor that provides constant time lookup of the largest (by default) element, at the expense of logarithmic insertion and extraction.
A user-provided ***i_cmp*** may be defined to set the ordering, e.g. using ***-c_default_cmp*** would cause the smallest element to appear as the top() value.
+Note that **cpque** does not support `i_valraw` and `i_valto`, so only cloning via `i_valfrom` is available.
+
See the c++ class [std::priority_queue](https://en.cppreference.com/w/cpp/container/priority_queue) for a functional reference.
## Header file and declaration
```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_cmp // three-way compare two i_val* : REQUIRED IF i_val is a non-integral type
#define i_del // 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
+#define i_valfrom // convertion func i_val => i_val - defaults to plain copy
#define i_tag // defaults to i_val
#include <stc/cpque.h>
```
@@ -37,7 +37,7 @@ cpque_X_value* cpque_X_top(const cpque_X* self);
void cpque_X_make_heap(cpque_X* self); // call after using push_back().
void cpque_X_push(cpque_X* self, cpque_X_value value);
-void cpque_X_emplace(cpque_X* self, cpque_X_rawvalue raw);
+void cpque_X_emplace(cpque_X* self, cpque_X_value val); // clones value
void cpque_X_pop(cpque_X* self);
void cpque_X_erase_at(cpque_X* self, size_t idx);
@@ -52,7 +52,6 @@ cpque_X_value cpque_X_value_clone(cpque_X_value val);
|:-------------------|:--------------------------------------|:------------------------|
| `cpque_X` | `struct {cpque_X_value* data; ...}` | The cpque type |
| `cpque_X_value` | `i_val` | The cpque element type |
-| `cpque_X_rawvalue` | `i_valraw` | cpque raw value type |
## Example
```c
diff --git a/docs/cvec_api.md b/docs/cvec_api.md
index 8053b108..00c0498c 100644
--- a/docs/cvec_api.md
+++ b/docs/cvec_api.md
@@ -29,14 +29,14 @@ 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(size_t size, i_val fill);
+cvec_X cvec_X_with_size(size_t size, i_val null);
cvec_X cvec_X_with_capacity(size_t size);
cvec_X cvec_X_clone(cvec_X vec);
void cvec_X_clear(cvec_X* self);
void cvec_X_copy(cvec_X* self, cvec_X other);
bool cvec_X_reserve(cvec_X* self, size_t cap);
-bool cvec_X_resize(cvec_X* self, size_t size, i_val fill);
+bool cvec_X_resize(cvec_X* self, size_t size, i_val null);
void cvec_X_shrink_to_fit(cvec_X* self);
void cvec_X_swap(cvec_X* a, cvec_X* b);
void cvec_X_del(cvec_X* self); // destructor