glouw / ctl

The C Template Library
MIT License
1.09k stars 56 forks source link

Don't store free/copy/compare function pointers #12

Open ghost opened 3 years ago

ghost commented 3 years ago

The existence of them is known at compile time based on P and T, so it should be possible to remove the function pointers from the structs. This is equivalent to what template C++ does.

For user overriding, it could be made so that FREE, COPY, COMPARE can be defined to custom function(s).

glouw commented 3 years ago

I suppose. Copy does fall back on implicit_copy. The additional ifdefs may make the source just that much more difficult to maintain

ghost commented 3 years ago

I'll show a patch for at least a few of the data structures, it shouldn't be too bad...