delete ptrAddr;
をboost::function0
にマップする必要がありますが、削除するためにいくつか問題があります。無料でうまく動作します。問題はstd::ptr_fun(operator delete)
のように見えますが、ヘルパーファンクタを書かずにこの作業を行う方法を理解できません。boost :: bindとdelete
boost::function0<void> Function;
Function = boost::bind(std::ptr_fun(free), (void*)malloc_string); //this works
Function = boost::bind(std::ptr_fun(operator delete), (void*)new_string); //doesn't work
Function(); //call function
がありますユーザー定義の型を扱うときにこのポインタを隠します。また、割り当てられたメモリを削除する前にデストラクタを呼び出します。 'std :: default_delete'に言及するには、new/deleteをmalloc/freeと一緒に使用しないでください。 –
sarat