diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/cspan.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/stc/cspan.h b/include/stc/cspan.h index 96439c64..1e12781e 100644 --- a/include/stc/cspan.h +++ b/include/stc/cspan.h @@ -61,7 +61,7 @@ int demo2() { #include "ccommon.h" #define using_cspan(Self, T, RANK) \ - typedef T Self##_value, Self##_raw; \ + typedef T Self##_value; typedef T Self##_raw; \ typedef struct { Self##_value *ref, *end; } Self##_iter; \ typedef struct { Self##_value *data; uint32_t dim[RANK]; } Self; \ \ @@ -90,6 +90,10 @@ int demo2() { #define cspan_make(array, ...) \ {.data=array, .dim={__VA_ARGS__}} +/* For static initialization use , cspan_init(). c_init() only works for non-static. */ +#define cspan_init(SpanType, ...) \ + {.data=(SpanType##_value[])__VA_ARGS__, .dim={sizeof((SpanType##_value[])__VA_ARGS__)/sizeof(SpanType##_value)}} + /* create a cspan from a cvec, cstack, cdeq, cqueue, or cpque (heap) */ #define cspan_from(container) \ {.data=(container)->data, .dim={(uint32_t)(container)->_len}} |
