Files
boost_smart_ptr/example/shared_ptr_example2.hpp

25 lines
839 B
C++
Raw Normal View History

2001-05-24 18:43:24 +00:00
// Boost shared_ptr_example2 header file -----------------------------------//
#include <boost/shared_ptr.hpp>
2001-05-24 18:43:24 +00:00
// This example demonstrates the handle/body idiom (also called pimpl and
// several other names). It separates the interface (in this header file)
// from the implementation (in shared_ptr_example2.cpp).
// Note that even though example::implementation is an incomplete type in
// some translation units using this header, shared_ptr< implementation >
// is still valid because the type is complete where it counts - in the
// shared_ptr_example2.cpp translation unit where functions requiring a
// complete type are actually instantiated.
class example
{
public:
2001-05-24 18:43:24 +00:00
example();
void do_something();
private:
2001-05-24 18:43:24 +00:00
class implementation;
boost::shared_ptr< implementation > _imp; // hide implementation details
};