From 4a37879119cd4d8b92c5dc578741052dd399f53f Mon Sep 17 00:00:00 2001 From: tylov Date: Mon, 24 Jul 2023 09:12:26 +0200 Subject: Updated docs, fix for issue #64. --- README.md | 15 ++++++++++----- 1 file 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 // 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 -- cgit v1.2.3