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

Public Types

typedef _Ptr_base< _Ty > _Myt
 
typedef _Ty element_type
 

Public Member Functions

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)
 

Private Attributes

_Ty * _Ptr
 
_Ref_count_base_Rep
 

Friends

template<class _Ty0 >
class _Ptr_base
 

Member Typedef Documentation

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

Constructor & Destructor Documentation

template<class _Ty>
constexpr _Ptr_base< _Ty >::_Ptr_base ( )
inline
273  : _Ptr(0), _Rep(0)
274  { // construct
275  }
_Ty * _Ptr
Definition: memory:429
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
_Ptr_base< _Ty >::_Ptr_base ( _Myt &&  _Right)
inline
278  : _Ptr(_Right._Ptr), _Rep(_Right._Rep)
279  { // construct _Ptr_base object that takes resource from _Right
280  _Right._Ptr = 0;
281  _Right._Rep = 0;
282  }
_Ty * _Ptr
Definition: memory:429
_Ref_count_base * _Rep
Definition: memory:430
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty>
template<class _Ty2 >
_Ptr_base< _Ty >::_Ptr_base ( _Ptr_base< _Ty2 > &&  _Right)
inline
286  : _Ptr(_Right._Ptr), _Rep(_Right._Rep)
287  { // construct _Ptr_base object that takes resource from _Right
288  _Right._Ptr = 0;
289  _Right._Rep = 0;
290  }
_Ty * _Ptr
Definition: memory:429
_Ref_count_base * _Rep
Definition: memory:430

Member Function Documentation

template<class _Ty>
void _Ptr_base< _Ty >::_Assign_rv ( _Myt &&  _Right)
inline
299  { // assign by moving _Right
300  _Swap(_Right);
301  }
void _Swap(_Ptr_base &_Right) _NOEXCEPT
Definition: memory:308
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty>
void _Ptr_base< _Ty >::_Decref ( )
inline
336  { // decrement reference count
337  if (_Rep != 0)
338  _Rep->_Decref();
339  }
void _Decref()
Definition: memory:108
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
void _Ptr_base< _Ty >::_Decwref ( )
inline
401  { // decrement weak reference count
402  if (_Rep != 0)
403  _Rep->_Decwref();
404  }
void _Decwref()
Definition: memory:117
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
bool _Ptr_base< _Ty >::_Expired ( ) const
inline
331  { // test if expired
332  return (!_Rep || _Rep->_Expired());
333  }
bool _Expired() const _NOEXCEPT
Definition: memory:128
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
_Ty* _Ptr_base< _Ty >::_Get ( ) const
inline
326  { // return pointer to resource
327  return (_Ptr);
328  }
_Ty * _Ptr
Definition: memory:429
template<class _Ty>
void* _Ptr_base< _Ty >::_Get_deleter ( const _XSTD2 type_info _Typeid) const
inline
321  { // return pointer to deleter object if its type is _Typeid
322  return (_Rep ? _Rep->_Get_deleter(_Typeid) : 0);
323  }
virtual void * _Get_deleter(const _XSTD2 type_info &) const _NOEXCEPT
Definition: memory:133
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
void _Ptr_base< _Ty >::_Reset ( )
inline
342  { // release resource
343  _Reset(0, 0);
344  }
void _Reset()
Definition: memory:341
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Reset ( const _Ptr_base< _Ty2 > &  _Other)
inline
348  { // release resource and take ownership of _Other._Ptr
349  _Reset(_Other._Ptr, _Other._Rep);
350  }
void _Reset()
Definition: memory:341
_Ty * _Ptr
Definition: memory:429
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Reset ( const _Ptr_base< _Ty2 > &  _Other,
bool  _Throw 
)
inline
354  { // release resource and take ownership from weak_ptr _Other._Ptr
355  _Reset(_Other._Ptr, _Other._Rep, _Throw);
356  }
void _Reset()
Definition: memory:341
_Ty * _Ptr
Definition: memory:429
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Reset ( _Ty *  _Other_ptr,
const _Ptr_base< _Ty2 > &  _Other 
)
inline
371  { // release resource and alias _Other_ptr with _Other
372  _Reset(_Other_ptr, _Other._Rep);
373  }
void _Reset()
Definition: memory:341
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
void _Ptr_base< _Ty >::_Reset ( _Ty *  _Other_ptr,
_Ref_count_base _Other_rep 
)
inline
376  { // release resource and take _Other_ptr through _Other_rep
377  if (_Other_rep)
378  _Other_rep->_Incref();
379  _Reset0(_Other_ptr, _Other_rep);
380  }
void _Incref()
Definition: memory:98
void _Reset0(_Ty *_Other_ptr, _Ref_count_base *_Other_rep)
Definition: memory:392
template<class _Ty>
void _Ptr_base< _Ty >::_Reset ( _Ty *  _Other_ptr,
_Ref_count_base _Other_rep,
bool  _Throw 
)
inline
383  { // take _Other_ptr through _Other_rep from weak_ptr if not expired
384  // otherwise, leave in default state if !_Throw,
385  // otherwise throw exception
386  if (_Other_rep && _Other_rep->_Incref_nz())
387  _Reset0(_Other_ptr, _Other_rep);
388  else if (_Throw)
390  }
bool _Incref_nz()
Definition: memory:69
Definition: memory:32
#define _THROW_NCEE(x, y)
Definition: xstddef:78
#define _EMPTY_ARGUMENT
Definition: xstddef:82
void _Reset0(_Ty *_Other_ptr, _Ref_count_base *_Other_rep)
Definition: memory:392
template<class _Ty>
void _Ptr_base< _Ty >::_Reset0 ( _Ty *  _Other_ptr,
_Ref_count_base _Other_rep 
)
inline
393  { // release resource and take new resource
394  if (_Rep != 0)
395  _Rep->_Decref();
396  _Rep = _Other_rep;
397  _Ptr = _Other_ptr;
398  }
void _Decref()
Definition: memory:108
_Ty * _Ptr
Definition: memory:429
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
void _Ptr_base< _Ty >::_Resetw ( )
inline
407  { // release weak reference to resource
408  _Resetw((_Ty *)0, 0);
409  }
void _Resetw()
Definition: memory:406
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Resetw ( const _Ptr_base< _Ty2 > &  _Other)
inline
413  { // release weak reference to resource and take _Other._Ptr
414  _Resetw(_Other._Ptr, _Other._Rep);
415  }
_Ty * _Ptr
Definition: memory:429
void _Resetw()
Definition: memory:406
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Resetw ( _Ty2 *  _Other_ptr,
_Ref_count_base _Other_rep 
)
inline
419  { // point to _Other_ptr through _Other_rep
420  if (_Other_rep)
421  _Other_rep->_Incwref();
422  if (_Rep != 0)
423  _Rep->_Decwref();
424  _Rep = _Other_rep;
425  _Ptr = const_cast<remove_cv_t<_Ty2> *>(_Other_ptr);
426  }
void _Incwref()
Definition: memory:103
_Ty * _Ptr
Definition: memory:429
typename remove_cv< _Ty >::type remove_cv_t
Definition: type_traits:1826
void _Decwref()
Definition: memory:117
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
void _Ptr_base< _Ty >::_Swap ( _Ptr_base< _Ty > &  _Right)
inline
309  { // swap pointers
310  _STD swap(_Rep, _Right._Rep);
311  _STD swap(_Ptr, _Right._Ptr);
312  }
void swap(shared_ptr< _Ty > &_Left, shared_ptr< _Ty > &_Right) _NOEXCEPT
Definition: memory:845
_Ty * _Ptr
Definition: memory:429
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
_Myt& _Ptr_base< _Ty >::operator= ( _Myt &&  _Right)
inline
293  { // construct _Ptr_base object that takes resource from _Right
295  return (*this);
296  }
void _Assign_rv(_Myt &&_Right)
Definition: memory:298
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 >
bool _Ptr_base< _Ty >::owner_before ( const _Ptr_base< _Ty2 > &  _Right) const
inline
316  { // compare addresses of manager objects
317  return (_Rep < _Right._Rep);
318  }
_Ref_count_base * _Rep
Definition: memory:430
template<class _Ty>
long _Ptr_base< _Ty >::use_count ( ) const
inline
304  { // return use count
305  return (_Rep ? _Rep->_Use_count() : 0);
306  }
long _Use_count() const _NOEXCEPT
Definition: memory:123
_Ref_count_base * _Rep
Definition: memory:430

Friends And Related Function Documentation

template<class _Ty>
template<class _Ty0 >
friend class _Ptr_base
friend

Member Data Documentation

template<class _Ty>
_Ty* _Ptr_base< _Ty >::_Ptr
private
template<class _Ty>
_Ref_count_base* _Ptr_base< _Ty >::_Rep
private

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