summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-09-21 08:57:43 +0200
committerGitHub <[email protected]>2021-09-21 08:57:43 +0200
commitbcd6e966bd9702e0c315213917d445c2370dd1ec (patch)
treedf462ea097d822a8e92f900bd42c129ab3dd796b
parent8d9520c0e9bedc37b48d0b74bab640bf237f90fd (diff)
downloadSTC-modified-bcd6e966bd9702e0c315213917d445c2370dd1ec.tar.gz
STC-modified-bcd6e966bd9702e0c315213917d445c2370dd1ec.zip
Update README.md
Added example suggested by ibgeek
-rw-r--r--README.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/README.md b/README.md
index 1ee52fdf..4fd34197 100644
--- a/README.md
+++ b/README.md
@@ -87,6 +87,22 @@ int main(void) {
cvec_float_del(&vec);
}
```
+In order to include two **cvec**s with different element types, include cvec.h twice. For structs, specify a compare function (or none), as `<` and `==` operators does not work on them (this enables sorting and searching).
+```c
+#define i_val struct One
+#define i_tag one
+#define i_cmp c_no_compare
+#include <stc/cvec.h>
+
+#define i_val struct Two
+#define i_tag two
+#define i_cmp c_no_compare
+#include <stc/cvec.h>
+...
+cvec_one v1 = cvec_one_init();
+cvec_two v2 = cvec_two_init();
+```
+
With six different containers:
```c
#include <stdio.h>