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 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 >
bool _Reset_weak (const _Ptr_base< _Ty2 > &_Other)
 
template<class _Ty2 >
void _Reset (_Ty *_Other_ptr, const _Ptr_base< _Ty2 > &_Other)
 
void _Reset (_Ty *_Other_ptr, _Ref_count_base *_Other_rep)
 
bool _Reset_weak (_Ty *_Other_ptr, _Ref_count_base *_Other_rep)
 
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
1427  { // construct empty weak_ptr object
1428  }
template<class _Ty>
weak_ptr< _Ty >::weak_ptr ( const weak_ptr< _Ty > &  _Other)
inline
1431  { // construct weak_ptr object for resource pointed to by _Other
1432  this->_Resetw(_Other);
1433  }
void _Resetw()
Definition: memory:831
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
1439  { // construct weak_ptr object for resource owned by _Other
1440  this->_Resetw(_Other);
1441  }
void _Resetw()
Definition: memory:831
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
1447  { // construct weak_ptr object for resource pointed to by _Other
1448  this->_Resetw(_Other.lock());
1449  }
shared_ptr< _Ty > lock() const _NOEXCEPT
Definition: memory:1518
void _Resetw()
Definition: memory:831
template<class _Ty>
weak_ptr< _Ty >::weak_ptr ( _Myt &&  _Other)
inline
1452  : _Mybase(_STD move(_Other))
1453  { // move construct from _Other
1454  }
_Ptr_base< _Ty > _Mybase
Definition: memory:1424
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
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
1460  { // move construct from _Other
1461  this->_Resetw(_Other.lock());
1462  _Other.reset();
1463  }
void reset() _NOEXCEPT
Definition: memory:1503
shared_ptr< _Ty > lock() const _NOEXCEPT
Definition: memory:1518
void _Resetw()
Definition: memory:831
template<class _Ty>
weak_ptr< _Ty >::~weak_ptr ( )
inline
1466  { // release resource
1467  this->_Decwref();
1468  }
void _Decwref()
Definition: memory:825

Member Function Documentation

template<class _Ty>
bool weak_ptr< _Ty >::expired ( ) const
inline
1514  { // return true if resource no longer exists
1515  return (this->_Expired());
1516  }
bool _Expired() const _NOEXCEPT
Definition: memory:753
template<class _Ty>
shared_ptr<_Ty> weak_ptr< _Ty >::lock ( ) const
inline
1519  { // convert to shared_ptr
1520  return (shared_ptr<_Ty>(_No_bad_weak_ptr{}, *this));
1521  }
Definition: memory:448
Definition: memory:665
template<class _Ty>
weak_ptr& weak_ptr< _Ty >::operator= ( const weak_ptr< _Ty > &  _Right)
inline
1471  { // assign from _Right
1472  this->_Resetw(_Right);
1473  return (*this);
1474  }
void _Resetw()
Definition: memory:831
template<class _Ty>
template<class _Ty2 >
weak_ptr& weak_ptr< _Ty >::operator= ( const weak_ptr< _Ty2 > &  _Right)
inline
1478  { // assign from _Right
1479  this->_Resetw(_Right.lock());
1480  return (*this);
1481  }
shared_ptr< _Ty > lock() const _NOEXCEPT
Definition: memory:1518
void _Resetw()
Definition: memory:831
template<class _Ty>
_Myt& weak_ptr< _Ty >::operator= ( _Myt &&  _Right)
inline
1484  { // move assign from _Right
1485  weak_ptr(_STD move(_Right)).swap(*this);
1486  return (*this);
1487  }
constexpr weak_ptr() _NOEXCEPT
Definition: memory:1426
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty>
template<class _Ty2 >
_Myt& weak_ptr< _Ty >::operator= ( weak_ptr< _Ty2 > &&  _Right)
inline
1491  { // move assign from _Right
1492  weak_ptr(_STD move(_Right)).swap(*this);
1493  return (*this);
1494  }
constexpr weak_ptr() _NOEXCEPT
Definition: memory:1426
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
template<class _Ty>
template<class _Ty2 >
weak_ptr& weak_ptr< _Ty >::operator= ( const shared_ptr< _Ty2 > &  _Right)
inline
1498  { // assign from _Right
1499  this->_Resetw(_Right);
1500  return (*this);
1501  }
void _Resetw()
Definition: memory:831
template<class _Ty>
void weak_ptr< _Ty >::reset ( )
inline
1504  { // release resource, convert to null weak_ptr object
1505  this->_Resetw();
1506  }
void _Resetw()
Definition: memory:831
template<class _Ty>
void weak_ptr< _Ty >::swap ( weak_ptr< _Ty > &  _Other)
inline
1509  { // swap pointers
1510  this->_Swap(_Other);
1511  }
void _Swap(_Ptr_base &_Right) _NOEXCEPT
Definition: memory:731

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