| 
									
										
										
										
											2001-05-24 18:43:24 +00:00
										 |  |  | //  Boost shared_ptr_example2 header file  -----------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-25 12:01:00 +00:00
										 |  |  | //  Copyright Beman Dawes 2001.  Distributed under the Boost
 | 
					
						
							|  |  |  | //  Software License, Version 1.0. (See accompanying file
 | 
					
						
							|  |  |  | //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-04 13:35:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-09-12 17:09:29 +00:00
										 |  |  | //  See http://www.boost.org/libs/smart_ptr for documentation.
 | 
					
						
							| 
									
										
										
										
											2003-02-04 13:35:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-02-02 18:36:12 +00:00
										 |  |  | #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 | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2003-01-25 16:51:45 +00:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2001-05-24 18:43:24 +00:00
										 |  |  |   example(); | 
					
						
							|  |  |  |   void do_something(); | 
					
						
							| 
									
										
										
										
											2003-01-25 16:51:45 +00:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2001-05-24 18:43:24 +00:00
										 |  |  |   class implementation; | 
					
						
							|  |  |  |   boost::shared_ptr< implementation > _imp; // hide implementation details
 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 |