STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Private Attributes | List of all members
auto_ptr< _Ty > Class Template Reference

Public Types

typedef auto_ptr< _Ty > _Myt
 
typedef _Ty element_type
 

Public Member Functions

 auto_ptr (_Ty *_Ptr=0) _THROW0()
 
 auto_ptr (_Myt &_Right) _THROW0()
 
 auto_ptr (auto_ptr_ref< _Ty > _Right) _THROW0()
 
template<class _Other >
 operator auto_ptr< _Other > () _THROW0()
 
template<class _Other >
 operator auto_ptr_ref< _Other > () _THROW0()
 
template<class _Other >
_Mytoperator= (auto_ptr< _Other > &_Right) _THROW0()
 
template<class _Other >
 auto_ptr (auto_ptr< _Other > &_Right) _THROW0()
 
_Mytoperator= (_Myt &_Right) _THROW0()
 
_Mytoperator= (auto_ptr_ref< _Ty > _Right) _THROW0()
 
 ~auto_ptr () _NOEXCEPT
 
_Ty & operator* () const _THROW0()
 
_Ty * operator-> () const _THROW0()
 
_Ty * get () const _THROW0()
 
_Ty * release () _THROW0()
 
void reset (_Ty *_Ptr=0)
 

Private Attributes

_Ty * _Myptr
 

Member Typedef Documentation

template<class _Ty>
typedef auto_ptr<_Ty> auto_ptr< _Ty >::_Myt
template<class _Ty>
typedef _Ty auto_ptr< _Ty >::element_type

Constructor & Destructor Documentation

template<class _Ty>
auto_ptr< _Ty >::auto_ptr ( _Ty *  _Ptr = 0)
inlineexplicit
891  : _Myptr(_Ptr)
892  { // construct from object pointer
893  }
_Ty * _Myptr
Definition: xmemory:994
template<class _Ty>
auto_ptr< _Ty >::auto_ptr ( _Myt _Right)
inline
896  : _Myptr(_Right.release())
897  { // construct by assuming pointer from _Right auto_ptr
898  }
_Ty * _Myptr
Definition: xmemory:994
const _Ty & _Right
Definition: algorithm:4087
template<class _Ty>
auto_ptr< _Ty >::auto_ptr ( auto_ptr_ref< _Ty >  _Right)
inline
901  { // construct by assuming pointer from _Right auto_ptr_ref
902  _Ty *_Ptr = _Right._Ref;
903  _Right._Ref = 0; // release old
904  _Myptr = _Ptr; // reset this
905  }
_Ty * _Myptr
Definition: xmemory:994
_Ty * _Ref
Definition: xmemory:880
template<class _Ty>
template<class _Other >
auto_ptr< _Ty >::auto_ptr ( auto_ptr< _Other > &  _Right)
inline
931  : _Myptr(_Right.release())
932  { // construct by assuming pointer from _Right
933  }
_Ty * _Myptr
Definition: xmemory:994
_Ty * release() _THROW0()
Definition: xmemory:979
template<class _Ty>
auto_ptr< _Ty >::~auto_ptr ( )
inline
950  { // destroy the object
951  delete _Myptr;
952  }
_Ty * _Myptr
Definition: xmemory:994

Member Function Documentation

template<class _Ty>
_Ty* auto_ptr< _Ty >::get ( ) const
inline
975  { // return wrapped pointer
976  return (_Myptr);
977  }
_Ty * _Myptr
Definition: xmemory:994
template<class _Ty>
template<class _Other >
auto_ptr< _Ty >::operator auto_ptr< _Other > ( )
inline
909  { // convert to compatible auto_ptr
910  return (auto_ptr<_Other>(*this));
911  }
Definition: xmemory:870
template<class _Ty>
template<class _Other >
auto_ptr< _Ty >::operator auto_ptr_ref< _Other > ( )
inline
915  { // convert to compatible auto_ptr_ref
916  _Other *_Cvtptr = _Myptr; // test implicit conversion
917  auto_ptr_ref<_Other> _Ans(_Cvtptr);
918  _Myptr = 0; // pass ownership to auto_ptr_ref
919  return (_Ans);
920  }
_Ty * _Myptr
Definition: xmemory:994
Definition: xmemory:873
template<class _Ty>
_Ty& auto_ptr< _Ty >::operator* ( ) const
inline
955  { // return designated value
956  #if _ITERATOR_DEBUG_LEVEL == 2
957  if (_Myptr == 0)
958  _DEBUG_ERROR("auto_ptr not dereferencable");
959  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
960 
961  return (*get());
962  }
_Ty * _Myptr
Definition: xmemory:994
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
template<class _Ty>
_Ty* auto_ptr< _Ty >::operator-> ( ) const
inline
965  { // return pointer to class object
966  #if _ITERATOR_DEBUG_LEVEL == 2
967  if (_Myptr == 0)
968  _DEBUG_ERROR("auto_ptr not dereferencable");
969  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
970 
971  return (get());
972  }
_Ty * _Myptr
Definition: xmemory:994
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
template<class _Ty>
template<class _Other >
_Myt& auto_ptr< _Ty >::operator= ( auto_ptr< _Other > &  _Right)
inline
924  { // assign compatible _Right (assume pointer)
925  reset(_Right.release());
926  return (*this);
927  }
void reset(_Ty *_Ptr=0)
Definition: xmemory:986
_Ty * release() _THROW0()
Definition: xmemory:979
template<class _Ty>
_Myt& auto_ptr< _Ty >::operator= ( _Myt _Right)
inline
936  { // assign compatible _Right (assume pointer)
937  reset(_Right.release());
938  return (*this);
939  }
void reset(_Ty *_Ptr=0)
Definition: xmemory:986
const _Ty & _Right
Definition: algorithm:4087
template<class _Ty>
_Myt& auto_ptr< _Ty >::operator= ( auto_ptr_ref< _Ty >  _Right)
inline
942  { // assign compatible _Right._Ref (assume pointer)
943  _Ty *_Ptr = _Right._Ref;
944  _Right._Ref = 0; // release old
945  reset(_Ptr); // set new
946  return (*this);
947  }
void reset(_Ty *_Ptr=0)
Definition: xmemory:986
_Ty * _Ref
Definition: xmemory:880
template<class _Ty>
_Ty* auto_ptr< _Ty >::release ( )
inline
980  { // return wrapped pointer and give up ownership
981  _Ty *_Tmp = _Myptr;
982  _Myptr = 0;
983  return (_Tmp);
984  }
_Ty * _Myptr
Definition: xmemory:994
template<class _Ty>
void auto_ptr< _Ty >::reset ( _Ty *  _Ptr = 0)
inline
987  { // destroy designated object and store new pointer
988  if (_Ptr != _Myptr)
989  delete _Myptr;
990  _Myptr = _Ptr;
991  }
_Ty * _Myptr
Definition: xmemory:994

Member Data Documentation

template<class _Ty>
_Ty* auto_ptr< _Ty >::_Myptr
private

The documentation for this class was generated from the following file: