/Src/Dependencies/Boost/libs/smart_ptr/example/scoped_ptr_example.hpp

http://hadesmem.googlecode.com/ · C++ Header · 29 lines · 12 code · 7 blank · 10 comment · 0 complexity · c9af012b16e9b8a7ecd29efafb388f27 MD5 · raw file

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