There are two headers in this gist which both define the destroy()
macro with the same
behavior but in slightly different ways.
##destroy.h##
This version of the destroy()
macro works with any compiler that supports __typeof__
, which
includes gcc and clang but unfortunately not MSVC. This version is completely type safe,
because no casts are used and therefore the compiler can check that all types are convertible.