1 // Boost scoped_ptr_example header file ------------------------------------// 2 3 // Copyright Beman Dawes 2001. Distributed under the Boost 4 // Software License, Version 1.0. (See accompanying file 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 7 8 // See http://www.boost.org/libs/smart_ptr for documentation. 9 10 #include <boost/utility.hpp> 11 #include <boost/scoped_ptr.hpp> 12 13 // The point of this example is to prove that even though 14 // example::implementation is an incomplete type in translation units using 15 // this header, scoped_ptr< implementation > is still valid because the type 16 // is complete where it counts - in the inplementation translation unit where 17 // destruction is actually instantiated. 18 19 class example : private boost::noncopyable 20 { 21 public: 22 example(); 23 ~example(); 24 void do_something(); 25 private: 26 class implementation; 27 boost::scoped_ptr< implementation > _imp; // hide implementation details 28 }; 29 30