diff options
| author | Tyge Løvset <[email protected]> | 2021-09-28 11:28:48 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-09-28 11:28:48 +0200 |
| commit | 98706bcd54d244c06dd1c23ef892d01363eaf3e6 (patch) | |
| tree | 354f1618dce58c3a3d6855017d5e6710913b12d9 | |
| parent | 98adc04d5031ad1087f5885129d26fcf2677162d (diff) | |
| download | STC-modified-98706bcd54d244c06dd1c23ef892d01363eaf3e6.tar.gz STC-modified-98706bcd54d244c06dd1c23ef892d01363eaf3e6.zip | |
Simplified usage of user-defined container names (and methods prefix).
| -rw-r--r-- | README.md | 9 | ||||
| -rw-r--r-- | include/stc/template.h | 6 |
2 files changed, 10 insertions, 5 deletions
@@ -331,12 +331,11 @@ typedef struct Dataset { #include <stc/cstack.h>
```
-User-defined container prefix
------------------------------
-Define either `i_prefix` or `i_tag` as empty:
+User-defined container type name
+--------------------------------
+Define `i_cnt` instead of `i_tag`:
```c
-#define i_prefix
-#define i_tag myvec
+#define i_cnt myvec
#define i_val int
#include <stc/cvec.h>
diff --git a/include/stc/template.h b/include/stc/template.h index 73f87f38..f0b0a8d7 100644 --- a/include/stc/template.h +++ b/include/stc/template.h @@ -51,6 +51,11 @@ #define i_tag F_tag
#define i_fwd
#endif
+#ifdef i_cnt
+ #define i_tag i_cnt
+ #undef i_prefix
+ #define i_prefix
+#endif
#ifndef i_prefix_csptr
#define i_prefix_csptr csptr_
@@ -186,6 +191,7 @@ #undef i_key_csptr
#undef i_val_csptr
#undef i_prefix_csptr
+#undef i_cnt
#undef Self
#undef i_template
|
