开发者

Interface implementation callbacks - management

开发者 https://www.devze.com 2023-02-01 04:34 出处:网络
I\'ve been thinking of creating some callbacks by interface inheritance. The question is, should I take, say, a shared_ptr, a unique_ptr, or a raw pointer? I don\'t want to define the memory managemen

I've been thinking of creating some callbacks by interface inheritance. The question is, should I take, say, a shared_ptr, a unique_ptr, or a raw pointer? I don't want to define the memory management of the derived class because, well, they should have their own undefined memory ma开发者_开发问答nagement.


std::function?

Your use sounds like exactly what std::function (well boost::function) is perfect for.

0

精彩评论

暂无评论...
验证码 换一张
取 消