28 #include <boost/noncopyable.hpp> 29 #include <boost/scoped_ptr.hpp> 42 class ImplPtr :
private boost::noncopyable
44 #if defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) || defined( BOOST_NO_CXX11_NULLPTR ) 45 typedef typename boost::scoped_ptr<_Impl>::unspecified_bool_type unspecified_bool_type;
49 typedef _Impl element_type;
52 ImplPtr( _Impl * impl_r = 0 ) : _impl( impl_r ) {}
55 void reset( _Impl * impl_r = 0 ) { _impl.reset( impl_r ); }
57 void swap(
ImplPtr rhs ) { _impl.swap( rhs._impl ); }
60 #if defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) || defined( BOOST_NO_CXX11_NULLPTR ) 61 operator unspecified_bool_type()
const {
return _impl; }
63 explicit operator bool ()
const {
return _impl.get() != 0; }
66 const _Impl & operator*()
const {
return *_impl; }
67 const _Impl * operator->()
const {
return _impl.get(); }
68 const _Impl *
get()
const {
return _impl.get(); }
70 _Impl & operator*() {
return *_impl; }
71 _Impl * operator->() {
return _impl.get(); }
72 _Impl *
get() {
return _impl.get(); }
75 boost::scoped_ptr<_Impl> _impl;
85 inline bool operator< ( ImplPtr<_Impl> & lhs,
ImplPtr<_Impl> & rhs ) {
return lhs.get() < rhs.get(); }
Helper template class for implementation pointers (pointers to a private class or structure that hold...