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.
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).