need a smart pointer that can be customized

For I need wrap some of the c code into class in my work, I have to deal with a lot of user defined structure pointers which can't be freed by simple delete. I wonder if there is a library which provides smart pointer whose copy constructor and destructor can be customized. Thanks for any recommendation.
Last edited on
A smart pointer doesn't do that. It just handles automatic memory cleanup.

You can just wrap your C structs in a class. The class lets you write your own ctors/dtors, then you can put that class in a smart pointer (and just use it everywhere in your C++ program).
Look up boost::smart_ptr library. You can write your own custom allocators and deleters.
Topic archived. No new replies allowed.