diff options
| author | tylov <[email protected]> | 2023-07-24 09:12:26 +0200 |
|---|---|---|
| committer | tylov <[email protected]> | 2023-07-24 09:12:26 +0200 |
| commit | 4a37879119cd4d8b92c5dc578741052dd399f53f (patch) | |
| tree | 50b51535d969955ffa6f379e1cd2d5b6deb6f3ac | |
| parent | 374b3c27831cd4e09461867ed231669777b96951 (diff) | |
| download | STC-modified-4a37879119cd4d8b92c5dc578741052dd399f53f.tar.gz STC-modified-4a37879119cd4d8b92c5dc578741052dd399f53f.zip | |
Updated docs, fix for issue #64.
| -rw-r--r-- | README.md | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -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> |
