Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 3
    Have you considered using the standard smart pointers (if you have access to C++11) ? Commented Dec 19, 2012 at 11:20
  • +1 on std::shared_ptr if you are using C++11. Otherwise it really comes down to whether you are already using boost or are planning to use boost, or interoperate with things using boost. I don't think it's worth including boost just for the shared_ptr, since cv::Ptr works well enough. Commented Dec 19, 2012 at 11:22
  • 2
    Which you use will rather depend on the APIs you are calling - these 3 flavours of smart pointer are not necessarily interchangeable, or provide conversion operators between themselves. For this reason, there are often good reasons to use the boost::shared_ptr implementation instead of std::shared_ptr when using other parts of the boost library. The same is likely to hold for OpenCV too. Commented Dec 19, 2012 at 11:28

default