diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | docs/csmap_api.md | 7 | ||||
| -rw-r--r-- | docs/csset_api.md | 2 |
3 files changed, 7 insertions, 4 deletions
@@ -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

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.
|
