summaryrefslogtreecommitdiffhomepage
path: root/README.md
diff options
context:
space:
mode:
authortylov <[email protected]>2023-07-24 09:12:26 +0200
committertylov <[email protected]>2023-07-24 09:12:26 +0200
commit4a37879119cd4d8b92c5dc578741052dd399f53f (patch)
tree50b51535d969955ffa6f379e1cd2d5b6deb6f3ac /README.md
parent374b3c27831cd4e09461867ed231669777b96951 (diff)
downloadSTC-modified-4a37879119cd4d8b92c5dc578741052dd399f53f.tar.gz
STC-modified-4a37879119cd4d8b92c5dc578741052dd399f53f.zip
Updated docs, fix for issue #64.
Diffstat (limited to 'README.md')
-rw-r--r--README.md15
1 files changed, 10 insertions, 5 deletions
diff --git a/README.md b/README.md
index 55c77ca4..c28e5773 100644
--- a/README.md
+++ b/README.md
@@ -532,17 +532,22 @@ MyVec_push_back(&vec, 1);
It is possible to forward declare containers. This is useful when a container is part of a struct,
but still not expose or include the full implementation / API of the container.
```c
-// Header file
+// Dataset.h
#include <stc/forward.h> // only include data structures
-forward_cstack(cstack_pnt, struct Point); // declare cstack_pnt (and cstack_pnt_value, cstack_pnt_iter);
- // struct Point may be an incomplete type.
+
+// declare cstack_pnt; struct Point may be an incomplete type.
+forward_cstack(cstack_pnt, struct Point);
typedef struct Dataset {
cstack_pnt vertices;
cstack_pnt colors;
} Dataset;
-// Implementation
-#define i_is_forward // flag that the container was forward declared.
+...
+// Dataset.c
+#include "Dataset.h"
+
+struct Point { int x, y, z; }; // Point must be defined here.
+#define i_is_forward // flag that the container was forward declared.
#define i_key struct Point
#define i_tag pnt
#include <stc/cstack.h>