1 // Boost shared_ptr_example2 implementation 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 "shared_ptr_example2.hpp" 11 #include <iostream> 12 13 class example::implementation 14 { 15 public: ~implementation()16 ~implementation() { std::cout << "destroying implementation\n"; } 17 }; 18 example()19example::example() : _imp( new implementation ) {} 20 do_something()21void example::do_something() 22 { std::cout << "use_count() is " << _imp.use_count() << "\n"; } 23