STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | List of all members
weak_ptr< _Ty > Class Template Reference
Inheritance diagram for weak_ptr< _Ty >:
_Ptr_base< _Ty >

Public Types

typedef weak_ptr< _Ty > _Myt
 
typedef _Ptr_base< _Ty > _Mybase
 
- Public Types inherited from _Ptr_base< _Ty >
typedef _Ptr_base< _Ty > _Myt
 
typedef _Ty element_type
 

Public Member Functions

constexpr weak_ptr () _NOEXCEPT
 
 weak_ptr (const weak_ptr &_Other) _NOEXCEPT
 
template<class _Ty2 , class = typename enable_if<is_convertible<_Ty2 *, _Ty *>::value, void>::type>
 weak_ptr (const shared_ptr< _Ty2 > &_Other) _NOEXCEPT
 
template<class _Ty2 , class = typename enable_if<is_convertible<_Ty2 *, _Ty *>::value, void>::type>
 weak_ptr (const weak_ptr< _Ty2 > &_Other) _NOEXCEPT
 
 weak_ptr (_Myt &&_Other) _NOEXCEPT
 
template<class _Ty2 , class = typename enable_if<is_convertible<_Ty2 *, _Ty *>::value, void>::type>
 weak_ptr (weak_ptr< _Ty2 > &&_Other) _NOEXCEPT
 
 ~weak_ptr () _NOEXCEPT
 
weak_ptroperator= (const weak_ptr &_Right) _NOEXCEPT
 
template<class _Ty2 >
weak_ptroperator= (const weak_ptr< _Ty2 > &_Right) _NOEXCEPT
 
_Mytoperator= (_Myt &&_Right) _NOEXCEPT
 
template<class _Ty2 >
_Mytoperator= (weak_ptr< _Ty2 > &&_Right) _NOEXCEPT
 
template<class _Ty2 >
weak_ptroperator= (const shared_ptr< _Ty2 > &_Right) _NOEXCEPT
 
void reset () _NOEXCEPT
 
void swap (weak_ptr &_Other) _NOEXCEPT
 
bool expired () const _NOEXCEPT
 
shared_ptr< _Ty > lock () const _NOEXCEPT
 
- Public Member Functions inherited from _Ptr_base< _Ty >
constexpr _Ptr_base () _NOEXCEPT
 
 _Ptr_base (_Myt &&_Right)
 
template<class _Ty2 >
 _Ptr_base (_Ptr_base< _Ty2 > &&_Right)
 
_Mytoperator= (_Myt &&_Right)
 
void _Assign_rv (_Myt &&_Right)
 
long use_count () const _NOEXCEPT
 
void _Swap (_Ptr_base &_Right) _NOEXCEPT
 
template<class _Ty2 >
bool owner_before (const _Ptr_base< _Ty2 > &_Right) const
 
void_Get_deleter (const _XSTD2 type_info &_Typeid) const _NOEXCEPT
 
_Ty * _Get () const _NOEXCEPT
 
bool _Expired () const _NOEXCEPT
 
void _Decref ()
 
void _Reset ()
 
template<class _Ty2 >
void _Reset (const _Ptr_base< _Ty2 > &_Other)
 
template<class _Ty2 >
void _Reset (const _Ptr_base< _Ty2 > &_Other, bool _Throw)
 
template<class _Ty2 >
void _Reset (_Ty *_Other_ptr, const _Ptr_base< _Ty2 > &_Other)
 
void _Reset (_Ty *_Other_ptr, _Ref_count_base *_Other_rep)
 
void _Reset (_Ty *_Other_ptr, _Ref_count_base *_Other_rep, bool _Throw)
 
void _Reset0 (_Ty *_Other_ptr, _Ref_count_base *_Other_rep)
 
void _Decwref ()
 
void _Resetw ()
 
template<class _Ty2 >
void _Resetw (const _Ptr_base< _Ty2 > &_Other)
 
template<class _Ty2 >
void _Resetw (_Ty2 *_Other_ptr, _Ref_count_base *_Other_rep)
 

Member Typedef Documentation

template<class _Ty>
typedef _Ptr_base<_Ty> weak_ptr< _Ty >::_Mybase
template<class _Ty>
typedef weak_ptr<_Ty> weak_ptr< _Ty >::_Myt

Constructor & Destructor Documentation

template<class _Ty>
constexpr weak_ptr< _Ty >::weak_ptr ( )
inline
1014  { // construct empty weak_ptr object
1015  }
template<class _Ty>
weak_ptr< _Ty >::weak_ptr ( const weak_ptr< _Ty > &  _Other)
inline
1018  { // construct weak_ptr object for resource pointed to by _Other
1019  this->_Resetw(_Other);
1020  }
void _Resetw()
Definition: memory:406
template<class _Ty>
template<class _Ty2 , class = typename enable_if<is_convertible<_Ty2 *, _Ty *>::value, void>::type>
weak_ptr< _Ty >::weak_ptr ( const shared_ptr< _Ty2 > &  _Other)
inline
1026  { // construct weak_ptr object for resource owned by _Other
1027  this->_Resetw(_Other);
1028  }
void _Resetw()
Definition: memory:406
template<class _Ty>
template<class _Ty2 , class = typename enable_if<is_convertible<_Ty2 *, _Ty *>::value, void>::type>
weak_ptr< _Ty >::weak_ptr ( const weak_ptr< _Ty2 > &  _Other)
inline
1034  { // construct weak_ptr object for resource pointed to by _Other
1035  this->_Resetw(_Other.lock());
1036  }
shared_ptr< _Ty > lock() const _NOEXCEPT
Definition: memory:1105
void _Resetw()
Definition: memory:406
template<class _Ty>
weak_ptr< _Ty >::weak_ptr ( _Myt &&  _Other)
inline
1039  : _Mybase(_STD move(_Other))
1040  { // move construct from _Other
1041  }
_Ptr_base< _Ty > _Mybase
Definition: memory:1011
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
template<class _Ty>
template<class _Ty2 , class = typename enable_if<is_convertible<_Ty2 *, _Ty *>::value, void>::type>
weak_ptr< _Ty >::weak_ptr ( weak_ptr< _Ty2 > &&  _Other)
inline
1047  { // move construct from _Other
1048  this->_Resetw(_Other.lock());
1049  _Other.reset();
1050  }
void reset() _NOEXCEPT
Definition: memory:1090
shared_ptr< _Ty > lock() const _NOEXCEPT
Definition: memory:1105
void _Resetw()
Definition: memory:406
template<class _Ty>
weak_ptr< _Ty >::~weak_ptr ( )
inline
1053  { // release resource
1054  this->_Decwref();
1055  }
void _Decwref()
Definition: memory:400

Member Function Documentation

template<class _Ty>
bool weak_ptr< _Ty >::expired ( ) const
inline
1101  { // return true if resource no longer exists
1102  return (this->_Expired());
1103  }
bool _Expired() const _NOEXCEPT
Definition: memory:330
template<class _Ty>
shared_ptr<_Ty> weak_ptr< _Ty >::lock ( ) const
inline
1106  { // convert to shared_ptr
1107  return (shared_ptr<_Ty>(*this, false));
1108  }
Definition: memory:242
template<class _Ty>
weak_ptr& weak_ptr< _Ty >::operator= ( const weak_ptr< _Ty > &  _Right)
inline
1058  { // assign from _Right
1059  this->_Resetw(_Right);
1060  return (*this);
1061  }
void _Resetw()
Definition: memory:406
template<class _Ty>
template<class _Ty2 >
weak_ptr& weak_ptr< _Ty >::operator= ( const weak_ptr< _Ty2 > &  _Right)
inline
1065  { // assign from _Right
1066  this->_Resetw(_Right.lock());
1067  return (*this);
1068  }
shared_ptr< _Ty > lock() const _NOEXCEPT
Definition: memory:1105
void _Resetw()
Definition: memory:406
template<class _Ty>
_Myt& weak_ptr< _Ty >::operator= ( _Myt &&  _Right)
inline
1071  { // move assign from _Right
1072  weak_ptr(_STD move(_Right)).swap(*this);
1073  return (*this);
1074  }
constexpr weak_ptr() _NOEXCEPT
Definition: memory:1013
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty>
template<class _Ty2 >
_Myt& weak_ptr< _Ty >::operator= ( weak_ptr< _Ty2 > &&  _Right)
inline
1078  { // move assign from _Right
1079  weak_ptr(_STD move(_Right)).swap(*this);
1080  return (*this);
1081  }
constexpr weak_ptr() _NOEXCEPT
Definition: memory:1013
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
template<class _Ty>
template<class _Ty2 >
weak_ptr& weak_ptr< _Ty >::operator= ( const shared_ptr< _Ty2 > &  _Right)
inline
1085  { // assign from _Right
1086  this->_Resetw(_Right);
1087  return (*this);
1088  }
void _Resetw()
Definition: memory:406
template<class _Ty>
void weak_ptr< _Ty >::reset ( )
inline
1091  { // release resource, convert to null weak_ptr object
1092  this->_Resetw();
1093  }
void _Resetw()
Definition: memory:406
template<class _Ty>
void weak_ptr< _Ty >::swap ( weak_ptr< _Ty > &  _Other)
inline
1096  { // swap pointers
1097  this->_Swap(_Other);
1098  }
void _Swap(_Ptr_base &_Right) _NOEXCEPT
Definition: memory:308

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