Boost logo

Boost Users :

Subject: Re: [Boost-users] [mem_fn] Ambiguous call to mem_fn with stdcallfunction
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-03-07 12:23:05


Conrad Scott:
...
> void test_mem_fn(IDirect3DDevice9 * const device)
> {
> boost::shared_ptr<IDirect3DDevice9> ptr(
> device,
> boost::mem_fn(&IDirect3DDevice9::Release) );
> }

There's also the option of using

struct com_deleter
{
    template<class T> void operator()(T* p) const
    {
        p->Release();
    }
};

void test(IDirect3DDevice9 * const device)
{
    boost::shared_ptr<IDirect3DDevice9> ptr(
        device,
        com_deleter() );
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net