Home > Software engineering >  Why do I need Boost.SmartPtr for the C compiler that supports C 11 and later?
Why do I need Boost.SmartPtr for the C compiler that supports C 11 and later?

Time:11-25

The boost C library is a famous sandbox for the language and Standard Library features that absorbed with each new version of the Standard C . However boost components that eventually became a part of the Standard are still present in boost. One of the classic examples of said above are smart pointers. So why do I need Boost.SmartPtr for the C compiler that supports C 11 and later?

CodePudding user response:

Why do I need Boost.SmartPtr for the C compiler that supports C 11 and later?

Because:

  1. You may need your program to compile with another compiler that doesn't support C 11 or later.
  2. You may not want to bother implementing make_unique yourself. Sure it's easy, but why do it when you can use an existing implementation?
  3. You may want to use one of the smart pointers provided by Boost.SmartPtr besides shared pointer.
  4. You may already have been using it, and don't want to pay for the effort of stopping using it.
  • Related