If they need a mapping for their own types then unfortunately for them they will have to create a map for their specific needs.
... copying and pasting are used and slight changes to the code are made to fit with what is needed.
This isn't needed - C has macros! While large macros aren't usually a great idea, because a concept like a map is extremely well-defined and unlikely to need continuous development, the boost of having less indirection and type-safety is probably worth it.
This isn't needed - C has macros! While large macros aren't usually a great idea, because a concept like a map is extremely well-defined and unlikely to need continuous development, the boost of having less indirection and type-safety is probably worth it.
Here's how it can end up looking
Here's a use of the above to make a
InvertedIndex
type:and its implementation file:
Using macros instead of void pointers for generic containers is a better idea, however, I find a huge macro for the implementation to be cumbersome.