diff options
| author | Tyge Løvset <[email protected]> | 2021-09-21 08:57:43 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-09-21 08:57:43 +0200 |
| commit | bcd6e966bd9702e0c315213917d445c2370dd1ec (patch) | |
| tree | df462ea097d822a8e92f900bd42c129ab3dd796b | |
| parent | 8d9520c0e9bedc37b48d0b74bab640bf237f90fd (diff) | |
| download | STC-modified-bcd6e966bd9702e0c315213917d445c2370dd1ec.tar.gz STC-modified-bcd6e966bd9702e0c315213917d445c2370dd1ec.zip | |
Update README.md
Added example suggested by ibgeek
| -rw-r--r-- | README.md | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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>
|
