Release() comes from IUnknown so why not just use that: void my_deleter(IUnknown* p) { // ... } ptr. Reset(p, &my_deleter) Note that Boost also has an intrusive_ptr which would seem more natural here: void intrusive_ptr_add_ref(IUnknown* p) { p->AddRef (); } void intrusive_ptr_release(IUnknown* p) { p->Release(); } boost::intrusive_ptr d3d(...); IDirect3D* p = 0; d3d. Reset(p) Your actual issue is probably that there is a non-template function SafeDeleter to specifically use the template-function you'd have to use something like: ptr.
Reset(p, boost::bind(&SafeDeleter, _1, &IDirect3D::Release)).
Release() comes from IUnknown- so why not just use that: void my_deleter(IUnknown* p) { // ... } ptr. Reset(p, &my_deleter); Note that Boost also has an intrusive_ptr which would seem more natural here: void intrusive_ptr_add_ref(IUnknown* p) { p->AddRef (); } void intrusive_ptr_release(IUnknown* p) { p->Release(); } boost::intrusive_ptr d3d(...); IDirect3D* p = 0; d3d. Reset(p); Your actual issue is probably that there is a non-template function SafeDeleter - to specifically use the template-function you'd have to use something like: ptr.
Reset(p, boost::bind(&SafeDeleter, _1, &IDirect3D::Release)).
Thanks for the answer. But expression with bind looks awful with template arguments. Better I'll just write my own deleter that will invoke Release.
– big-z Aug 12 '10 at 8:04 @Kirill: According to the documented effects of ctor/dtor/reset() I don't see why that check is neccessary. (sorry for the undecided back-and-forth-rolling) – Georg Fritzsche Aug 13 '10 at 20:17 Yes, you are right. I mixed up with shared_ptr.
– Kirill V. Lyadvinsky Aug 14 '10 at 7:19.
But the following code gives a lot of error (looks like it dumps the whole bind. What's wrong with my using of bind?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.