summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-15 15:40:08 +0100
committerTyge Løvset <[email protected]>2023-02-15 15:40:08 +0100
commit290055ad96c22fd9dfb539d0217e45cd2f1cdb91 (patch)
treece6d1398ca4a08ddcb42653ad46c0ab76655ee47 /docs
parente456085a392d063df1a2495422523a2474ea6a18 (diff)
downloadSTC-modified-290055ad96c22fd9dfb539d0217e45cd2f1cdb91.tar.gz
STC-modified-290055ad96c22fd9dfb539d0217e45cd2f1cdb91.zip
Cleaned up in size-types. API always uses intptr_t as default for all containers.
Diffstat (limited to 'docs')
-rw-r--r--docs/cmap_api.md15
-rw-r--r--docs/cset_api.md8
-rw-r--r--docs/csmap_api.md13
-rw-r--r--docs/csset_api.md7
4 files changed, 23 insertions, 20 deletions
diff --git a/docs/cmap_api.md b/docs/cmap_api.md
index 76fbda92..998146a7 100644
--- a/docs/cmap_api.md
+++ b/docs/cmap_api.md
@@ -38,7 +38,7 @@ See the c++ class [std::unordered_map](https://en.cppreference.com/w/cpp/contain
#define i_tag // alternative typename: cmap_{i_tag}. i_tag defaults to i_val
#define i_hash_functor // advanced, see examples/functor.c for similar usage.
#define i_eq_functor // advanced, see examples/functor.c for similar usage.
-#define i_ssize // default int32_t. If defined, table expand 2x (else 1.5x)
+#define i_ssize // internal; default int32_t. If defined, table expand 2x (else 1.5x)
#include <stc/cmap.h>
```
`X` should be replaced by the value of `i_tag` in all of the following documentation.
@@ -47,20 +47,20 @@ See the c++ class [std::unordered_map](https://en.cppreference.com/w/cpp/contain
```c
cmap_X cmap_X_init(void);
-cmap_X cmap_X_with_capacity(i_ssize cap);
+cmap_X cmap_X_with_capacity(intptr_t cap);
cmap_X cmap_X_clone(cmap_x map);
void cmap_X_clear(cmap_X* self);
void cmap_X_copy(cmap_X* self, const cmap_X* other);
float cmap_X_max_load_factor(const cmap_X* self); // default: 0.85f
-bool cmap_X_reserve(cmap_X* self, i_ssize size);
+bool cmap_X_reserve(cmap_X* self, intptr_t size);
void cmap_X_shrink_to_fit(cmap_X* self);
void cmap_X_drop(cmap_X* self); // destructor
bool cmap_X_empty(const cmap_X* self );
-i_ssize cmap_X_size(const cmap_X* self);
-i_ssize cmap_X_capacity(const cmap_X* self); // buckets * max_load_factor
-i_ssize cmap_X_bucket_count(const cmap_X* self); // num. of allocated buckets
+intptr_t cmap_X_size(const cmap_X* self);
+intptr_t cmap_X_capacity(const cmap_X* self); // buckets * max_load_factor
+intptr_t cmap_X_bucket_count(const cmap_X* self); // num. of allocated buckets
const cmap_X_mapped* cmap_X_at(const cmap_X* self, i_keyraw rkey); // rkey must be in map
cmap_X_mapped* cmap_X_at_mut(cmap_X* self, i_keyraw rkey); // mutable at
@@ -74,7 +74,8 @@ cmap_X_result cmap_X_insert_or_assign(cmap_X* self, i_key key, i_val map
cmap_X_result cmap_X_push(cmap_X* self, cmap_X_value entry); // similar to insert
cmap_X_result cmap_X_emplace(cmap_X* self, i_keyraw rkey, i_valraw rmapped); // no change if rkey in map
-cmap_X_result cmap_X_emplace_or_assign(cmap_X* self, i_keyraw rkey, i_valraw rmapped); // always update rmapped
+cmap_X_result cmap_X_emplace_or_assign(cmap_X* self, i_keyraw rkey, i_valraw rmapped); // always update
+cmap_X_result cmap_X_put(cmap_X* self, i_keyraw rkey, i_valraw rmapped); // emplace_or_assign() alias
int cmap_X_erase(cmap_X* self, i_keyraw rkey); // return 0 or 1
cmap_X_iter cmap_X_erase_at(cmap_X* self, cmap_X_iter it); // return iter after it
diff --git a/docs/cset_api.md b/docs/cset_api.md
index 34b6f3eb..287f7636 100644
--- a/docs/cset_api.md
+++ b/docs/cset_api.md
@@ -36,14 +36,14 @@ cset_X cset_X_clone(cset_x set);
void cset_X_clear(cset_X* self);
void cset_X_copy(cset_X* self, const cset_X* other);
float cset_X_max_load_factor(const cset_X* self); // default: 0.85
-bool cset_X_reserve(cset_X* self, i_ssize size);
+bool cset_X_reserve(cset_X* self, intptr_t size);
void cset_X_shrink_to_fit(cset_X* self);
void cset_X_drop(cset_X* self); // destructor
-i_ssize cset_X_size(const cset_X* self); // num. of allocated buckets
-i_ssize cset_X_capacity(const cset_X* self); // buckets * max_load_factor
bool cset_X_empty(const cset_X* self);
-i_ssize cset_X_bucket_count(const cset_X* self);
+intptr_t cset_X_size(const cset_X* self); // num. of allocated buckets
+intptr_t cset_X_capacity(const cset_X* self); // buckets * max_load_factor
+intptr_t cset_X_bucket_count(const cset_X* self);
bool cset_X_contains(const cset_X* self, i_keyraw rkey);
const cset_X_value* cset_X_get(const cset_X* self, i_keyraw rkey); // return NULL if not found
diff --git a/docs/csmap_api.md b/docs/csmap_api.md
index 19a654d6..89948369 100644
--- a/docs/csmap_api.md
+++ b/docs/csmap_api.md
@@ -34,7 +34,7 @@ See the c++ class [std::map](https://en.cppreference.com/w/cpp/container/map) fo
#define i_tag // alternative typename: csmap_{i_tag}. i_tag defaults to i_val
#define i_cmp_functor // advanced, see examples/functor.c for similar usage.
-#define i_ssize // defaults to int32_t
+#define i_ssize // internal size rep. defaults to int32_t
#include <stc/csmap.h>
```
`X` should be replaced by the value of `i_tag` in all of the following documentation.
@@ -43,8 +43,8 @@ See the c++ class [std::map](https://en.cppreference.com/w/cpp/container/map) fo
```c
csmap_X csmap_X_init(void);
-csset_X csmap_X_with_capacity(i_ssize cap);
-bool csmap_X_reserve(csmap_X* self, i_ssize cap);
+csset_X csmap_X_with_capacity(intptr_t cap);
+bool csmap_X_reserve(csmap_X* self, intptr_t cap);
void csmap_X_shrink_to_fit(csmap_X* self);
csmap_X csmap_X_clone(csmap_x map);
@@ -53,8 +53,8 @@ void csmap_X_copy(csmap_X* self, const csmap_X* other);
void csmap_X_drop(csmap_X* self); // destructor
bool csmap_X_empty(const csmap_X* self);
-i_ssize csmap_X_size(const csmap_X* self);
-i_ssize csmap_X_capacity(const csmap_X* self);
+intptr_t csmap_X_size(const csmap_X* self);
+intptr_t csmap_X_capacity(const csmap_X* self);
const csmap_X_mapped* csmap_X_at(const csmap_X* self, i_keyraw rkey); // rkey must be in map
csmap_X_mapped* csmap_X_at_mut(csmap_X* self, i_keyraw rkey); // mutable at
@@ -74,6 +74,7 @@ csmap_X_result csmap_X_push(csmap_X* self, csmap_X_value entry);
csmap_X_result csmap_X_emplace(csmap_X* self, i_keyraw rkey, i_valraw rmapped); // no change if rkey in map
csmap_X_result csmap_X_emplace_or_assign(csmap_X* self, i_keyraw rkey, i_valraw rmapped); // always update rmapped
+csmap_X_result csmap_X_put(csmap_X* self, i_keyraw rkey, i_valraw rmapped); // csmap_X_emplace_or_assign() alias
int csmap_X_erase(csmap_X* self, i_keyraw rkey);
csmap_X_iter csmap_X_erase_at(csmap_X* self, csmap_X_iter it); // returns iter after it
@@ -82,7 +83,7 @@ csmap_X_iter csmap_X_erase_range(csmap_X* self, csmap_X_iter it1, csmap
csmap_X_iter csmap_X_begin(const csmap_X* self);
csmap_X_iter csmap_X_end(const csmap_X* self);
void csmap_X_next(csmap_X_iter* iter);
-csmap_X_iter csmap_X_advance(csmap_X_iter it, i_ssize n);
+csmap_X_iter csmap_X_advance(csmap_X_iter it, intptr_t n);
csmap_X_value csmap_X_value_clone(csmap_X_value val);
csmap_X_raw csmap_X_value_toraw(csmap_X_value* pval);
diff --git a/docs/csset_api.md b/docs/csset_api.md
index c696eab5..80ee1844 100644
--- a/docs/csset_api.md
+++ b/docs/csset_api.md
@@ -29,8 +29,8 @@ See the c++ class [std::set](https://en.cppreference.com/w/cpp/container/set) fo
```c
csset_X csset_X_init(void);
-csset_X csset_X_with_capacity(i_ssize cap);
-bool csset_X_reserve(csset_X* self, i_ssize cap);
+csset_X csset_X_with_capacity(intptr_t cap);
+bool csset_X_reserve(csset_X* self, intptr_t cap);
void csset_X_shrink_to_fit(csset_X* self);
csset_X csset_X_clone(csset_x set);
@@ -38,8 +38,9 @@ void csset_X_clear(csset_X* self);
void csset_X_copy(csset_X* self, const csset_X* other);
void csset_X_drop(csset_X* self); // destructor
-i_ssize csset_X_size(const csset_X* self);
bool csset_X_empty(const csset_X* self);
+intptr_t csset_X_size(const csset_X* self);
+intptr_t csset_X_capacity(const csset_X* self);
const csset_X_value* csset_X_get(const csset_X* self, i_keyraw rkey); // const get
csset_X_value* csset_X_get_mut(csset_X* self, i_keyraw rkey); // return NULL if not found