summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-09-28 11:28:48 +0200
committerTyge Løvset <[email protected]>2021-09-28 11:28:48 +0200
commit98706bcd54d244c06dd1c23ef892d01363eaf3e6 (patch)
tree354f1618dce58c3a3d6855017d5e6710913b12d9
parent98adc04d5031ad1087f5885129d26fcf2677162d (diff)
downloadSTC-modified-98706bcd54d244c06dd1c23ef892d01363eaf3e6.tar.gz
STC-modified-98706bcd54d244c06dd1c23ef892d01363eaf3e6.zip
Simplified usage of user-defined container names (and methods prefix).
-rw-r--r--README.md9
-rw-r--r--include/stc/template.h6
2 files changed, 10 insertions, 5 deletions
diff --git a/README.md b/README.md
index f64eb515..49edc853 100644
--- a/README.md
+++ b/README.md
@@ -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