summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-01-17 12:27:21 +0100
committerTyge Løvset <[email protected]>2021-01-17 12:27:21 +0100
commit7acf9651556a5a42023f61dda8cbdd0c406aaaed (patch)
tree48b813fc1853815c8eda5ce746eaee761f8b7efe
parent468b3563369468c8c5a5e17738de783bace34ccc (diff)
downloadSTC-modified-7acf9651556a5a42023f61dda8cbdd0c406aaaed.tar.gz
STC-modified-7acf9651556a5a42023f61dda8cbdd0c406aaaed.zip
Fixed some csmap/csset docs issues.
-rw-r--r--README.md2
-rw-r--r--docs/csmap_api.md7
-rw-r--r--docs/csset_api.md2
3 files changed, 7 insertions, 4 deletions
diff --git a/README.md b/README.md
index bb6c664a..6ffff62e 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,8 @@ This is a small headers only library with the most used container components, an
- [***cdeq*** - Templated **std::deque** alike type](docs/cdeq_api.md)
- [***cmap*** - Templated **std::unordered_map** alike type](docs/cmap_api.md)
- [***cset*** - Templated **std::unordered_set** alike type](docs/cset_api.md)
+- [***csmap*** - Templated **std::map** sorted map alike type](docs/csmap_api.md)
+- [***csset*** - Templated **std::set** sorted set alike type](docs/csset_api.md)
- [***cstack*** - Templated **std::stack** alike adapter type](docs/cstack_api.md)
- [***cqueue*** - Templated **std::queue** alike adapter type](docs/cqueue_api.md)
- [***cpque*** - Templated **std::priority_queue** alike adapter type](docs/cpque_api.md)
diff --git a/docs/csmap_api.md b/docs/csmap_api.md
index 7dede1be..d4406978 100644
--- a/docs/csmap_api.md
+++ b/docs/csmap_api.md
@@ -179,10 +179,11 @@ Demonstrate csmap with plain-old-data key type Vec3i and int as mapped type: csm
#include <stdio.h>
typedef struct { int x, y, z; } Vec3i;
+
static int Vec3i_compare(const Vec3i* a, const Vec3i* b) {
- if (a->x != b->x) return c_default_compare(a->x, b->x);
- if (a->y != b->y) return c_default_compare(a->y, b->y);
- return c_default_compare(a->z, b->z);
+ if (a->x != b->x) return c_default_compare(&a->x, &b->x);
+ if (a->y != b->y) return c_default_compare(&a->y, &b->y);
+ return c_default_compare(&a->z, &b->z);
}
using_csmap(v3, Vec3i, int, c_default_del, // mapped: empty int destroy func
diff --git a/docs/csset_api.md b/docs/csset_api.md
index b7f9884b..27a744f3 100644
--- a/docs/csset_api.md
+++ b/docs/csset_api.md
@@ -1,4 +1,4 @@
-# STC Container [csset](../stc/cmap.h): Unordered Set
+# STC Container [csset](../stc/csmap.h): Sorted Set
![Set](pics/sset.jpg)
A **csset** is an associative container that contains a sorted set of unique objects of type *Key*. Sorting is done using the key comparison function *keyCompare*. Search, removal, and insertion operations have logarithmic complexity. **csset** is implemented as a AA-tree. See [std::set](https://en.cppreference.com/w/cpp/container/set) for a similar c++ class.