2001-05-22 18:58:21 +00:00
|
|
|
// Boost scoped_ptr_example header file ------------------------------------//
|
|
|
|
|
2003-02-04 13:35:06 +00:00
|
|
|
// (C) Copyright Beman Dawes 2001. Permission to copy,
|
|
|
|
// use, modify, sell and distribute this software is granted provided this
|
|
|
|
// copyright notice appears in all copies. This software is provided "as is"
|
|
|
|
// without express or implied warranty, and with no claim as to its
|
|
|
|
// suitability for any purpose.
|
|
|
|
|
|
|
|
// See http://www.boost.org for most recent version including documentation.
|
|
|
|
|
2002-02-03 15:19:04 +00:00
|
|
|
#include <boost/utility.hpp>
|
2002-02-02 18:36:12 +00:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2001-05-22 18:58:21 +00:00
|
|
|
|
|
|
|
// The point of this example is to prove that even though
|
|
|
|
// example::implementation is an incomplete type in translation units using
|
|
|
|
// this header, scoped_ptr< implementation > is still valid because the type
|
|
|
|
// is complete where it counts - in the inplementation translation unit where
|
|
|
|
// destruction is actually instantiated.
|
|
|
|
|
2002-02-08 20:08:15 +00:00
|
|
|
class example : private boost::noncopyable
|
2001-05-22 18:58:21 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
example();
|
|
|
|
~example();
|
|
|
|
void do_something();
|
|
|
|
private:
|
|
|
|
class implementation;
|
|
|
|
boost::scoped_ptr< implementation > _imp; // hide implementation details
|
|
|
|
};
|
|
|
|
|