1

I have some code which uses boost::intrusive_ptr. The advantages of using boost::intrusive_ptr over std::shared_ptr is interesting to me. I read about these from these two blogs.

I would like to know if I could replace boost::intrusive_ptr with something else. I can replace boost::scoped_ptr with std::unique_ptr by enabling c++11 support. The motive for this change is that I need to bundle whole boost library (only headers) with the source. Note that, I am not using linking to boost libraries anywhere in my code.

I would be glad, if someone knows an alternative to boost::intrusive_ptr or boost's smart pointers in general.

rkm
  • 892
  • 2
  • 16
  • 32
  • 2
    You can just write your own. Or, `std::make_shared` is to some degree an alternative in that it avoids the creation of a separate control block object. But that doesn't help for e.g. COM classes. – Cheers and hth. - Alf May 10 '15 at 09:38
  • I dont have COM classes. So I think writing own is only option. BTW, std::make_shared have any performance issue as I read in the blog (link in the question) – rkm May 10 '15 at 09:47
  • Is there any alternative libraries for boost::smart_ptr. I head of loki library. But it seems highly inactive. – rkm May 10 '15 at 14:45
  • You can easily take the intrusive_ptr header from boost source code, then remove all boost dependencies from it. In an hour or two, you'll get a completely standalone intrusive_ptr implementation. – stgatilov Feb 06 '18 at 13:03

0 Answers0