A library defines an opaque data type:
struct OpaqueStruct;
and the client code has to obtain and release an OpaqueStruct*
. I have access to the library source.
Unfortunately, neither shared_ptr
nor unique_ptr
cannot store that pointer giving an
error: invalid application of ‘sizeof’ to incomplete type.
The best thing I can think of is to borrow the finally guard from this post.
How do I use RAII for opaque struct pointers?