using a custom deleter for std::shared_ptr on a direct3d11 object

与世无争的帅哥 提交于 2019-12-04 08:03:48

How about this?

std::shared_ptr<ID3D11Device> ptr(nullptr, [](ID3D11Device* ptr){ptr->Release();} ); 

Try This

struct Releaser{
    void operator()(ID3D11Device* p){
        p->Release();

    };

};


std::shared_ptr<ID3D11Device> ptr(nullptr, Releaser());
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!