[Home]Smart Ptr.Hpp Include Weak Ptr.Hpp - Smart Ptr Sugg

BOOST WIKI | RecentChanges | Preferences | Page List | Links List


Back to Suggestions - Smart ptr library

smart_ptr.hpp should include weak_ptr.hpp, etc.

For convenience, logical continuity, and consistency with other Boost libraries, you should be able to include all the smart_ptr pieces with

    #include <boost/smart_ptr.hpp>

Currently, only 4 are included:

    #include <boost/scoped_ptr.hpp>
    #include <boost/scoped_array.hpp>
    #include <boost/shared_ptr.hpp>
    #include <boost/shared_array.hpp>

Missing are:

    #include <boost/weak_ptr.hpp>
    #include <boost/intrusive_ptr.hpp>
    #include <boost/enable_shared_from_this.hpp>

If the idea was to leave out rarely-used, specialized pieces, in order to cut down on extraneous compile time, then I'd suggest that weak_ptr.hpp needs to be included in smart_ptr.hpp -- it seems to me to be one of the essential, common components of the smart_ptr system.

It took me awhile to debug my first test program, because I couldn't figure out how to get a weak_ptr to compile -- turned out I didn't have weak_ptr.hpp included, which was very puzzling to me, since I had included smart_ptr.hpp (which is why it took so long for me to figure it out...)

    - People/Chuck Messenger

BOOST WIKI | RecentChanges | Preferences | Page List | Links List
Edit text of this page | View other revisions
Last edited May 27, 2003 4:20 am (diff)
Disclaimer: This site not officially maintained by Boost Developers