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

Public Types

typedef unique_ptr< _Ty, _Dx > _Myt
 
typedef _Unique_ptr_base< _Ty, _Dx > _Mybase
 
typedef _Mybase::pointer pointer
 
typedef _Ty element_type
 
typedef _Dx deleter_type
 
- Public Types inherited from _Unique_ptr_base< _Ty, _Dx >
typedef remove_reference_t< _Dx > _Dx_noref
 
typedef _Get_deleter_pointer_type< _Ty, _Dx_noref >::type pointer
 

Public Member Functions

constexpr unique_ptr () _NOEXCEPT
 
constexpr unique_ptr (nullptr_t) _NOEXCEPT
 
_Mytoperator= (nullptr_t) _NOEXCEPT
 
 unique_ptr (pointer _Ptr) _NOEXCEPT
 
 unique_ptr (pointer _Ptr, typename _If< is_reference< _Dx >::value, _Dx, const typename remove_reference< _Dx >::type & >::type _Dt) _NOEXCEPT
 
 unique_ptr (pointer _Ptr, typename remove_reference< _Dx >::type &&_Dt) _NOEXCEPT
 
 unique_ptr (unique_ptr &&_Right) _NOEXCEPT
 
template<class _Ty2 , class _Dx2 , class = typename enable_if<!is_array<_Ty2>::value && is_convertible<typename unique_ptr<_Ty2, _Dx2>::pointer, pointer>::value && (is_reference<_Dx>::value ? is_same<_Dx2, _Dx>::value : is_convertible<_Dx2, _Dx>::value), void>::type>
 unique_ptr (unique_ptr< _Ty2, _Dx2 > &&_Right) _NOEXCEPT
 
template<class _Ty2 , class _Dx2 >
enable_if<!is_array< _Ty2 >::value &&is_assignable< _Dx &, _Dx2 && >::value &&is_convertible< typename unique_ptr< _Ty2, _Dx2 >::pointer, pointer >::value, _Myt & >::type operator= (unique_ptr< _Ty2, _Dx2 > &&_Right) _NOEXCEPT
 
_Mytoperator= (_Myt &&_Right) _NOEXCEPT
 
void swap (_Myt &_Right) _NOEXCEPT
 
 ~unique_ptr () _NOEXCEPT
 
add_lvalue_reference< _Ty >::type operator* () const
 
pointer operator-> () const _NOEXCEPT
 
pointer get () const _NOEXCEPT
 
 operator bool () const _NOEXCEPT
 
pointer release () _NOEXCEPT
 
void reset (pointer _Ptr=pointer()) _NOEXCEPT
 
 unique_ptr (const _Myt &)=delete
 
_Mytoperator= (const _Myt &)=delete
 
- Public Member Functions inherited from _Unique_ptr_base< _Ty, _Dx >
template<class _Ptr2 , class _Dx2 >
 _Unique_ptr_base (_Ptr2 _Ptr, _Dx2 &&_Dt)
 
template<class _Ptr2 >
constexpr _Unique_ptr_base (_Ptr2 _Ptr)
 
_Dx & get_deleter () _NOEXCEPT
 
const _Dx & get_deleter () const _NOEXCEPT
 
pointer_Myptr () _NOEXCEPT
 
const pointer_Myptr () const _NOEXCEPT
 

Additional Inherited Members

- Public Attributes inherited from _Unique_ptr_base< _Ty, _Dx >
_Compressed_pair< _Dx, pointer_Mypair
 

Member Typedef Documentation

template<class _Ty, class _Dx>
typedef _Unique_ptr_base<_Ty, _Dx> unique_ptr< _Ty, _Dx >::_Mybase
template<class _Ty, class _Dx>
typedef unique_ptr<_Ty, _Dx> unique_ptr< _Ty, _Dx >::_Myt
template<class _Ty, class _Dx>
typedef _Dx unique_ptr< _Ty, _Dx >::deleter_type
template<class _Ty, class _Dx>
typedef _Ty unique_ptr< _Ty, _Dx >::element_type
template<class _Ty, class _Dx>
typedef _Mybase::pointer unique_ptr< _Ty, _Dx >::pointer

Constructor & Destructor Documentation

template<class _Ty, class _Dx>
constexpr unique_ptr< _Ty, _Dx >::unique_ptr ( )
inline
1712  : _Mybase(pointer())
1713  { // default construct
1714  static_assert(!is_pointer<_Dx>::value,
1715  "unique_ptr constructed with null deleter pointer");
1716  }
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1704
Definition: type_traits:366
_Mybase::pointer pointer
Definition: memory:1705
template<class _Ty, class _Dx>
constexpr unique_ptr< _Ty, _Dx >::unique_ptr ( nullptr_t  )
inline
1719  : _Mybase(pointer())
1720  { // null pointer construct
1721  static_assert(!is_pointer<_Dx>::value,
1722  "unique_ptr constructed with null deleter pointer");
1723  }
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1704
Definition: type_traits:366
_Mybase::pointer pointer
Definition: memory:1705
template<class _Ty, class _Dx>
unique_ptr< _Ty, _Dx >::unique_ptr ( pointer  _Ptr)
inlineexplicit
1732  : _Mybase(_Ptr)
1733  { // construct with pointer
1734  static_assert(!is_pointer<_Dx>::value,
1735  "unique_ptr constructed with null deleter pointer");
1736  }
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1704
Definition: type_traits:366
template<class _Ty, class _Dx>
unique_ptr< _Ty, _Dx >::unique_ptr ( pointer  _Ptr,
typename _If< is_reference< _Dx >::value, _Dx, const typename remove_reference< _Dx >::type & >::type  _Dt 
)
inline
1741  : _Mybase(_Ptr, _Dt)
1742  { // construct with pointer and (maybe const) deleter&
1743  }
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1704
template<class _Ty, class _Dx>
unique_ptr< _Ty, _Dx >::unique_ptr ( pointer  _Ptr,
typename remove_reference< _Dx >::type &&  _Dt 
)
inline
1747  : _Mybase(_Ptr, _STD move(_Dt))
1748  { // construct by moving deleter
1749  static_assert(!is_reference<_Dx>::value,
1750  "unique_ptr constructed with reference to rvalue deleter");
1751  }
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1704
Definition: type_traits:315
template<class _Ty, class _Dx>
unique_ptr< _Ty, _Dx >::unique_ptr ( unique_ptr< _Ty, _Dx > &&  _Right)
inline
1754  : _Mybase(_Right.release(),
1755  _STD forward<_Dx>(_Right.get_deleter()))
1756  { // construct by moving _Right
1757  }
pointer release() _NOEXCEPT
Definition: memory:1842
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1673
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1704
template<class _Ty, class _Dx>
template<class _Ty2 , class _Dx2 , class = typename enable_if<!is_array<_Ty2>::value && is_convertible<typename unique_ptr<_Ty2, _Dx2>::pointer, pointer>::value && (is_reference<_Dx>::value ? is_same<_Dx2, _Dx>::value : is_convertible<_Dx2, _Dx>::value), void>::type>
unique_ptr< _Ty, _Dx >::unique_ptr ( unique_ptr< _Ty2, _Dx2 > &&  _Right)
inline
1769  : _Mybase(_Right.release(),
1770  _STD forward<_Dx2>(_Right.get_deleter()))
1771  { // construct by moving _Right
1772  }
pointer release() _NOEXCEPT
Definition: memory:1842
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1673
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1704
template<class _Ty, class _Dx>
unique_ptr< _Ty, _Dx >::~unique_ptr ( )
inline
1817  { // destroy the object
1818  if (get() != pointer())
1819  this->get_deleter()(get());
1820  }
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1673
_Mybase::pointer pointer
Definition: memory:1705
template<class _Ty, class _Dx>
unique_ptr< _Ty, _Dx >::unique_ptr ( const _Myt )
delete

Member Function Documentation

template<class _Ty, class _Dx>
pointer unique_ptr< _Ty, _Dx >::get ( ) const
inline
1833  { // return pointer to object
1834  return (this->_Myptr());
1835  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1683
template<class _Ty, class _Dx>
unique_ptr< _Ty, _Dx >::operator bool ( ) const
inlineexplicit
1838  { // test for non-null pointer
1839  return (get() != pointer());
1840  }
_Mybase::pointer pointer
Definition: memory:1705
template<class _Ty, class _Dx>
add_lvalue_reference<_Ty>::type unique_ptr< _Ty, _Dx >::operator* ( ) const
inline
1823  { // return reference to object
1824  return (*get());
1825  }
template<class _Ty, class _Dx>
pointer unique_ptr< _Ty, _Dx >::operator-> ( ) const
inline
1828  { // return pointer to class object
1829  return (this->_Myptr());
1830  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1683
template<class _Ty, class _Dx>
_Myt& unique_ptr< _Ty, _Dx >::operator= ( nullptr_t  )
inline
1726  { // assign a null pointer
1727  reset();
1728  return (*this);
1729  }
void reset(pointer _Ptr=pointer()) _NOEXCEPT
Definition: memory:1849
template<class _Ty, class _Dx>
template<class _Ty2 , class _Dx2 >
enable_if<!is_array<_Ty2>::value && is_assignable<_Dx&, _Dx2&&>::value && is_convertible<typename unique_ptr<_Ty2, _Dx2>::pointer, pointer>::value, _Myt&>::type unique_ptr< _Ty, _Dx >::operator= ( unique_ptr< _Ty2, _Dx2 > &&  _Right)
inline
1793  { // assign by moving _Right
1794  reset(_Right.release());
1795  this->get_deleter() = _STD forward<_Dx2>(_Right.get_deleter());
1796  return (*this);
1797  }
void reset(pointer _Ptr=pointer()) _NOEXCEPT
Definition: memory:1849
pointer release() _NOEXCEPT
Definition: memory:1842
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1673
template<class _Ty, class _Dx>
_Myt& unique_ptr< _Ty, _Dx >::operator= ( _Myt &&  _Right)
inline
1800  { // assign by moving _Right
1801  if (this != _STD addressof(_Right))
1802  { // different, do the move
1803  reset(_Right.release());
1804  this->get_deleter() = _STD forward<_Dx>(_Right.get_deleter());
1805  }
1806  return (*this);
1807  }
void reset(pointer _Ptr=pointer()) _NOEXCEPT
Definition: memory:1849
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1673
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty, class _Dx>
_Myt& unique_ptr< _Ty, _Dx >::operator= ( const _Myt )
delete
template<class _Ty, class _Dx>
pointer unique_ptr< _Ty, _Dx >::release ( )
inline
1843  { // yield ownership of pointer
1844  pointer _Ans = get();
1845  this->_Myptr() = pointer();
1846  return (_Ans);
1847  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1683
_Mybase::pointer pointer
Definition: memory:1705
template<class _Ty, class _Dx>
void unique_ptr< _Ty, _Dx >::reset ( pointer  _Ptr = pointer())
inline
1850  { // establish new pointer
1851  pointer _Old = get();
1852  this->_Myptr() = _Ptr;
1853  if (_Old != pointer())
1854  this->get_deleter()(_Old);
1855  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1683
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1673
_Mybase::pointer pointer
Definition: memory:1705
template<class _Ty, class _Dx>
void unique_ptr< _Ty, _Dx >::swap ( _Myt _Right)
inline
1810  { // swap elements
1811  _Swap_adl(this->_Myptr(), _Right._Myptr());
1812  _Swap_adl(this->get_deleter(),
1813  _Right.get_deleter());
1814  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1683
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1673
void _Swap_adl(_Ty &_Left, _Ty &_Right) _NOEXCEPT_OP(_Is_nothrow_swappable< _Ty >
Definition: utility:73
constexpr const _Ty &() _Right
Definition: algorithm:3723

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