Generic Containers in C: Vec
uecker.codeberg.page
Generic Containers in C: Vec
1–10 of 91 posts
Re: Generic Containers in C: Vec
#2Towards safe containers in C.
Re: Generic Containers in C: Vec
#3Here's a generic vector used in real world code: https://gitlab.com/nbdkit/nbdkit/-/blob/master/common/utils/...
Re: Generic Containers in C: Vec
#4I doubt I'd want to use a dynamic array in C without a custom allocator.
Re: Generic Containers in C: Vec
#5And if I want a vec(int *)?
These token pasting 'generic' macros never work for non-trivial types.
Re: Generic Containers in C: Vec
#6I think the overwhelmingly better approach for C is codegen here. Better ergonomics, tab completion, less error prone, etc. As long as your codegen is solid!
Re: Generic Containers in C: Vec
#7[deleted]
Re: Generic Containers in C: Vec
#8Why do you need to pass the type to vec_push? Can't T be replaced by typeof(v->data[0]) ?
Re: Generic Containers in C: Vec
#9And if I want a vec(int *)? These token pasting 'generic' macros never work for non-trivial types.
Correct, complex types must be typedef'd. At least, until c2y integrates _Record as per N3332: https://thephd.dev/_vendor/future_cxx/papers/C%20-%20_Record...
Re: Generic Containers in C: Vec
#10Here is my version of this concept, I tried to keep it as simple as possible: https://github.com/camel-cdr/cauldron/blob/main/cauldron/str...