I have a class. It has a function void delete_ptr(void *);
and void push_into(std::set<my_string> ** pps);
. I have 10 instances of this class. Each one is allocated on difrent heap. I have my programm in the main heap, same where my map is. I want to call each of my class instances push_into
with my map from main. each of push_into will call (**pps).insert(std::string("Hello str"));
or (**pps).insert("Hello char");
. How to create such my_string
class that would keep **std::string
in it and also ptr
to delete_ptr
of class that creates my_string
class instance?
Main objectives I wonder about are:
You can use boost::shared_ptr
with custom deallocator. Provide your delete_ptr
as a custom deallocator using boost::bind