Brian Silverman | 355f11d | 2018-08-04 23:57:00 -0700 | [diff] [blame^] | 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: |
| 16 | ~implementation() { std::cout << "destroying implementation\n"; } |
| 17 | }; |
| 18 | |
| 19 | example::example() : _imp( new implementation ) {} |
| 20 | |
| 21 | void example::do_something() |
| 22 | { std::cout << "use_count() is " << _imp.use_count() << "\n"; } |