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

 _Ptr_base ()
 
 _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)
 
template<class _Ty2 >
bool owner_before (const _Ptr_base< _Ty2 > &_Right) const
 
void_Get_deleter (const _XSTD2 type_info &_Typeid) const
 
_Ty * _Get () const
 
bool _Expired () const
 
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 (const _Ptr_base< _Ty2 > &_Other, const _Static_tag &)
 
template<class _Ty2 >
void _Reset (const _Ptr_base< _Ty2 > &_Other, const _Const_tag &)
 
template<class _Ty2 >
void _Reset (const _Ptr_base< _Ty2 > &_Other, const _Dynamic_tag &)
 
template<class _Ty2 >
void _Reset (auto_ptr< _Ty2 > &&_Other)
 
template<class _Ty2 >
void _Reset (_Ty *_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 (const _Ty2 *_Other_ptr, _Ref_count_base *_Other_rep)
 
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>
_Ptr_base< _Ty >::_Ptr_base ( )
inline
278  : _Ptr(0), _Rep(0)
279  { // construct
280  }
_Ty * _Ptr
Definition: memory:460
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
_Ptr_base< _Ty >::_Ptr_base ( _Myt &&  _Right)
inline
283  : _Ptr(0), _Rep(0)
284  { // construct _Ptr_base object that takes resource from _Right
285  _Assign_rv(_STD forward<_Myt>(_Right));
286  }
_Ty * _Ptr
Definition: memory:460
void _Assign_rv(_Myt &&_Right)
Definition: memory:302
_Ref_count_base * _Rep
Definition: memory:461
const _Ty & _Right
Definition: algorithm:4087
template<class _Ty>
template<class _Ty2 >
_Ptr_base< _Ty >::_Ptr_base ( _Ptr_base< _Ty2 > &&  _Right)
inline
290  : _Ptr(_Right._Ptr), _Rep(_Right._Rep)
291  { // construct _Ptr_base object that takes resource from _Right
292  _Right._Ptr = 0;
293  _Right._Rep = 0;
294  }
_Ty * _Ptr
Definition: memory:460
_Ref_count_base * _Rep
Definition: memory:461

Member Function Documentation

template<class _Ty>
void _Ptr_base< _Ty >::_Assign_rv ( _Myt &&  _Right)
inline
303  { // assign by moving _Right
304  if (this != &_Right)
305  _Swap(_Right);
306  }
void _Swap(_Ptr_base &_Right)
Definition: memory:313
const _Ty & _Right
Definition: algorithm:4087
template<class _Ty>
void _Ptr_base< _Ty >::_Decref ( )
inline
341  { // decrement reference count
342  if (_Rep != 0)
343  _Rep->_Decref();
344  }
void _Decref()
Definition: memory:114
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
void _Ptr_base< _Ty >::_Decwref ( )
inline
426  { // decrement weak reference count
427  if (_Rep != 0)
428  _Rep->_Decwref();
429  }
void _Decwref()
Definition: memory:123
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
bool _Ptr_base< _Ty >::_Expired ( ) const
inline
336  { // test if expired
337  return (!_Rep || _Rep->_Expired());
338  }
bool _Expired() const
Definition: memory:134
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
_Ty* _Ptr_base< _Ty >::_Get ( ) const
inline
331  { // return pointer to resource
332  return (_Ptr);
333  }
_Ty * _Ptr
Definition: memory:460
template<class _Ty>
void* _Ptr_base< _Ty >::_Get_deleter ( const _XSTD2 type_info _Typeid) const
inline
326  { // return pointer to deleter object if its type is _Typeid
327  return (_Rep ? _Rep->_Get_deleter(_Typeid) : 0);
328  }
virtual void * _Get_deleter(const _XSTD2 type_info &) const
Definition: memory:139
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
void _Ptr_base< _Ty >::_Reset ( )
inline
347  { // release resource
348  _Reset(0, 0);
349  }
void _Reset()
Definition: memory:346
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Reset ( const _Ptr_base< _Ty2 > &  _Other)
inline
353  { // release resource and take ownership of _Other._Ptr
354  _Reset(_Other._Ptr, _Other._Rep);
355  }
void _Reset()
Definition: memory:346
_Ty * _Ptr
Definition: memory:460
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Reset ( const _Ptr_base< _Ty2 > &  _Other,
bool  _Throw 
)
inline
359  { // release resource and take ownership from weak_ptr _Other._Ptr
360  _Reset(_Other._Ptr, _Other._Rep, _Throw);
361  }
void _Reset()
Definition: memory:346
_Ty * _Ptr
Definition: memory:460
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Reset ( const _Ptr_base< _Ty2 > &  _Other,
const _Static_tag  
)
inline
365  { // release resource and take ownership of _Other._Ptr
366  _Reset(static_cast<_Ty *>(_Other._Ptr), _Other._Rep);
367  }
void _Reset()
Definition: memory:346
_Ty * _Ptr
Definition: memory:460
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Reset ( const _Ptr_base< _Ty2 > &  _Other,
const _Const_tag  
)
inline
371  { // release resource and take ownership of _Other._Ptr
372  _Reset(const_cast<_Ty *>(_Other._Ptr), _Other._Rep);
373  }
void _Reset()
Definition: memory:346
_Ty * _Ptr
Definition: memory:460
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Reset ( const _Ptr_base< _Ty2 > &  _Other,
const _Dynamic_tag  
)
inline
377  { // release resource and take ownership of _Other._Ptr
378  _Ty *_Ptr = dynamic_cast<_Ty *>(_Other._Ptr);
379  if (_Ptr)
380  _Reset(_Ptr, _Other._Rep);
381  else
382  _Reset();
383  }
void _Reset()
Definition: memory:346
_Ty * _Ptr
Definition: memory:460
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Reset ( auto_ptr< _Ty2 > &&  _Other)
inline
387  { // release resource and take _Other.get()
388  _Ty2 *_Px = _Other.get();
389  _Reset0(_Px, new _Ref_count<_Ty>(_Px));
390  _Other.release();
391  _Enable_shared(_Px, _Rep);
392  }
void _Enable_shared(_Ty *_Ptr, _Ref_count_base *_Refptr, typename _Ty::_EStype *=0)
Definition: memory:257
_Ty * get() const _THROW0()
Definition: xmemory:974
Definition: memory:147
_Ref_count_base * _Rep
Definition: memory:461
_Ty * release() _THROW0()
Definition: xmemory:979
void _Reset0(_Ty *_Other_ptr, _Ref_count_base *_Other_rep)
Definition: memory:417
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Reset ( _Ty *  _Ptr,
const _Ptr_base< _Ty2 > &  _Other 
)
inline
396  { // release resource and alias _Ptr with _Other_rep
397  _Reset(_Ptr, _Other._Rep);
398  }
void _Reset()
Definition: memory:346
_Ty * _Ptr
Definition: memory:460
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
void _Ptr_base< _Ty >::_Reset ( _Ty *  _Other_ptr,
_Ref_count_base _Other_rep 
)
inline
401  { // release resource and take _Other_ptr through _Other_rep
402  if (_Other_rep)
403  _Other_rep->_Incref();
404  _Reset0(_Other_ptr, _Other_rep);
405  }
void _Incref()
Definition: memory:104
void _Reset0(_Ty *_Other_ptr, _Ref_count_base *_Other_rep)
Definition: memory:417
template<class _Ty>
void _Ptr_base< _Ty >::_Reset ( _Ty *  _Other_ptr,
_Ref_count_base _Other_rep,
bool  _Throw 
)
inline
408  { // take _Other_ptr through _Other_rep from weak_ptr if not expired
409  // otherwise, leave in default state if !_Throw,
410  // otherwise throw exception
411  if (_Other_rep && _Other_rep->_Incref_nz())
412  _Reset0(_Other_ptr, _Other_rep);
413  else if (_Throw)
415  }
bool _Incref_nz()
Definition: memory:70
Definition: memory:33
#define _THROW_NCEE(x, y)
Definition: xstddef:79
void _Reset0(_Ty *_Other_ptr, _Ref_count_base *_Other_rep)
Definition: memory:417
template<class _Ty>
void _Ptr_base< _Ty >::_Reset0 ( _Ty *  _Other_ptr,
_Ref_count_base _Other_rep 
)
inline
418  { // release resource and take new resource
419  if (_Rep != 0)
420  _Rep->_Decref();
421  _Rep = _Other_rep;
422  _Ptr = _Other_ptr;
423  }
void _Decref()
Definition: memory:114
_Ty * _Ptr
Definition: memory:460
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
void _Ptr_base< _Ty >::_Resetw ( )
inline
432  { // release weak reference to resource
433  _Resetw((_Ty *)0, 0);
434  }
void _Resetw()
Definition: memory:431
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Resetw ( const _Ptr_base< _Ty2 > &  _Other)
inline
438  { // release weak reference to resource and take _Other._Ptr
439  _Resetw(_Other._Ptr, _Other._Rep);
440  }
_Ty * _Ptr
Definition: memory:460
void _Resetw()
Definition: memory:431
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Resetw ( const _Ty2 *  _Other_ptr,
_Ref_count_base _Other_rep 
)
inline
444  { // point to _Other_ptr through _Other_rep
445  _Resetw(const_cast<_Ty2*>(_Other_ptr), _Other_rep);
446  }
void _Resetw()
Definition: memory:431
template<class _Ty>
template<class _Ty2 >
void _Ptr_base< _Ty >::_Resetw ( _Ty2 *  _Other_ptr,
_Ref_count_base _Other_rep 
)
inline
450  { // point to _Other_ptr through _Other_rep
451  if (_Other_rep)
452  _Other_rep->_Incwref();
453  if (_Rep != 0)
454  _Rep->_Decwref();
455  _Rep = _Other_rep;
456  _Ptr = _Other_ptr;
457  }
void _Incwref()
Definition: memory:109
_Ty * _Ptr
Definition: memory:460
void _Decwref()
Definition: memory:123
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
void _Ptr_base< _Ty >::_Swap ( _Ptr_base< _Ty > &  _Right)
inline
314  { // swap pointers
315  _STD swap(_Rep, _Right._Rep);
316  _STD swap(_Ptr, _Right._Ptr);
317  }
void swap(shared_ptr< _Ty > &_Left, shared_ptr< _Ty > &_Right) _NOEXCEPT
Definition: memory:885
_Ty * _Ptr
Definition: memory:460
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
_Myt& _Ptr_base< _Ty >::operator= ( _Myt &&  _Right)
inline
297  { // construct _Ptr_base object that takes resource from _Right
298  _Assign_rv(_STD forward<_Myt>(_Right));
299  return (*this);
300  }
void _Assign_rv(_Myt &&_Right)
Definition: memory:302
const _Ty & _Right
Definition: algorithm:4087
template<class _Ty>
template<class _Ty2 >
bool _Ptr_base< _Ty >::owner_before ( const _Ptr_base< _Ty2 > &  _Right) const
inline
321  { // compare addresses of manager objects
322  return (_Rep < _Right._Rep);
323  }
_Ref_count_base * _Rep
Definition: memory:461
template<class _Ty>
long _Ptr_base< _Ty >::use_count ( ) const
inline
309  { // return use count
310  return (_Rep ? _Rep->_Use_count() : 0);
311  }
_Ref_count_base * _Rep
Definition: memory:461
long _Use_count() const
Definition: memory:129

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: