How Does Smart_ptr Fit with the Standard Library?


The Smart_ptr library has been proposed for inclusion in the Standard Library, and there are primarily three reasons for this:

  • The Standard Library currently offers only auto_ptr, which is but one type of smart pointer, covering only one part of the smart pointer spectrum. shared_ptr offers different, arguably even more important, functionality.

  • The Boost smart pointers are specifically designed to work well with, and be a natural extension to, the Standard Library. For example, before shared_ptr, there were no standard smart pointers that could be used as elements in containers.

  • Real-world programmers have proven these smart pointer classes through heavy use in their own programs for a long time.

The preceding reasons make the Smart_ptr library a very useful addition to the C++ Standard Library. Boost.Smart_ptr's shared_ptr (and the accompanying helper enable_shared_from_this) and weak_ptr have been accepted for the upcoming Library Technical Report.



    Beyond the C++ Standard Library(c) An Introduction to Boost
    Beyond the C++ Standard Library: An Introduction to Boost
    ISBN: 0321133544
    EAN: 2147483647
    Year: 2006
    Pages: 125

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net