summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-12-31 14:08:33 +0100
committerTyge Løvset <[email protected]>2020-12-31 14:08:33 +0100
commitcc17bd340be209921df8ec1ef5cd2b744e74f098 (patch)
tree0224c538082d9a2b5d02f2be6eaa8912a2789ddd
parent57dc2c1475aee45e0541c7eacc3ae7a74d5b5bd1 (diff)
downloadSTC-modified-cc17bd340be209921df8ec1ef5cd2b744e74f098.tar.gz
STC-modified-cc17bd340be209921df8ec1ef5cd2b744e74f098.zip
Added picture.
-rw-r--r--README.md17
-rw-r--r--docs/containers-small.jpgbin0 -> 115086 bytes
2 files changed, 11 insertions, 6 deletions
diff --git a/README.md b/README.md
index 1258559e..d965c0ff 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,12 @@
+![Standard Template Containers](docs/containers-small.jpg)
+
STC - Standard Template Containers for C
========================================
Introduction
------------
-An modern, fully typesafe, generic, customizable, user-friendly, consistent, and very fast standard container library for C99.
+An modern, fully typesafe, generic, customizable, user-friendly, consistent, and very fast container library for C99.
This is a small headers only library with the most used container components, and a few algorithms:
- [***cstr*** - A **std::string** alike type](docs/cstr_api.md)
- [***cvec*** - Templated **std::vector** alike type](docs/cvec_api.md)
@@ -22,7 +24,7 @@ This is a small headers only library with the most used container components, an
- [***copt*** - Implements ***copt_get()***, similar to posix **getopt_long()**](docs/copt_api.md)
- [***ccommon*** - General definitions](docs/ccommon_api.md)
-The usage of the containers is similar to the C++ standard containers, so it should be easy if you are familiar with them.
+The usage of the containers is similar to the C++ standard containers in STL, so it should be easy if you are familiar with them.
All containers mentioned above, except cstr_t and cbitset_t, are generic and therefore typesafe (similar to templates in C++).
No casting is used. A simple example:
@@ -50,10 +52,13 @@ typedef struct {
int id;
} User;
-int User_compare(User* a, User* b)
- { int c = strcmp(a->name.str, b->name.str); return c != 0 ? c : a->id - b->id; }
-void User_del(User* user)
- { cstr_del(&user->name); }
+int User_compare(const User* a, const User* b) {
+ int c = strcmp(a->name.str, b->name.str);
+ return c != 0 ? c : a->id - b->id;
+}
+void User_del(User* user) {
+ cstr_del(&user->name);
+}
using_cvec(u, User, User_compare, User_del);
diff --git a/docs/containers-small.jpg b/docs/containers-small.jpg
new file mode 100644
index 00000000..5f50a0ab
--- /dev/null
+++ b/docs/containers-small.jpg
Binary files differ