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< _Dx >::type _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
1290  : _Mybase(pointer())
1291  { // default construct
1292  static_assert(!is_pointer<_Dx>::value,
1293  "unique_ptr constructed with null deleter pointer");
1294  }
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1282
Definition: type_traits:298
_Mybase::pointer pointer
Definition: memory:1283
template<class _Ty, class _Dx>
constexpr unique_ptr< _Ty, _Dx >::unique_ptr ( nullptr_t  )
inline
1297  : _Mybase(pointer())
1298  { // null pointer construct
1299  static_assert(!is_pointer<_Dx>::value,
1300  "unique_ptr constructed with null deleter pointer");
1301  }
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1282
Definition: type_traits:298
_Mybase::pointer pointer
Definition: memory:1283
template<class _Ty, class _Dx>
unique_ptr< _Ty, _Dx >::unique_ptr ( pointer  _Ptr)
inlineexplicit
1310  : _Mybase(_Ptr)
1311  { // construct with pointer
1312  static_assert(!is_pointer<_Dx>::value,
1313  "unique_ptr constructed with null deleter pointer");
1314  }
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1282
Definition: type_traits:298
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
1319  : _Mybase(_Ptr, _Dt)
1320  { // construct with pointer and (maybe const) deleter&
1321  }
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1282
template<class _Ty, class _Dx>
unique_ptr< _Ty, _Dx >::unique_ptr ( pointer  _Ptr,
typename remove_reference< _Dx >::type &&  _Dt 
)
inline
1325  : _Mybase(_Ptr, _STD move(_Dt))
1326  { // construct by moving deleter
1327  static_assert(!is_reference<_Dx>::value,
1328  "unique_ptr constructed with reference to rvalue deleter");
1329  }
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1282
Definition: type_traits:247
template<class _Ty, class _Dx>
unique_ptr< _Ty, _Dx >::unique_ptr ( unique_ptr< _Ty, _Dx > &&  _Right)
inline
1332  : _Mybase(_Right.release(),
1333  _STD forward<_Dx>(_Right.get_deleter()))
1334  { // construct by moving _Right
1335  }
pointer release() _NOEXCEPT
Definition: memory:1420
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1282
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
1347  : _Mybase(_Right.release(),
1348  _STD forward<_Dx2>(_Right.get_deleter()))
1349  { // construct by moving _Right
1350  }
pointer release() _NOEXCEPT
Definition: memory:1420
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1282
template<class _Ty, class _Dx>
unique_ptr< _Ty, _Dx >::~unique_ptr ( )
inline
1395  { // destroy the object
1396  if (get() != pointer())
1397  this->get_deleter()(get());
1398  }
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
_Mybase::pointer pointer
Definition: memory:1283
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
1411  { // return pointer to object
1412  return (this->_Myptr());
1413  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1261
template<class _Ty, class _Dx>
unique_ptr< _Ty, _Dx >::operator bool ( ) const
inlineexplicit
1416  { // test for non-null pointer
1417  return (get() != pointer());
1418  }
_Mybase::pointer pointer
Definition: memory:1283
template<class _Ty, class _Dx>
add_lvalue_reference<_Ty>::type unique_ptr< _Ty, _Dx >::operator* ( ) const
inline
1401  { // return reference to object
1402  return (*get());
1403  }
template<class _Ty, class _Dx>
pointer unique_ptr< _Ty, _Dx >::operator-> ( ) const
inline
1406  { // return pointer to class object
1407  return (pointer_traits<pointer>::pointer_to(**this));
1408  }
Definition: xmemory0:244
template<class _Ty, class _Dx>
_Myt& unique_ptr< _Ty, _Dx >::operator= ( nullptr_t  )
inline
1304  { // assign a null pointer
1305  reset();
1306  return (*this);
1307  }
void reset(pointer _Ptr=pointer()) _NOEXCEPT
Definition: memory:1427
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
1371  { // assign by moving _Right
1372  reset(_Right.release());
1373  this->get_deleter() = _STD forward<_Dx2>(_Right.get_deleter());
1374  return (*this);
1375  }
void reset(pointer _Ptr=pointer()) _NOEXCEPT
Definition: memory:1427
pointer release() _NOEXCEPT
Definition: memory:1420
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
template<class _Ty, class _Dx>
_Myt& unique_ptr< _Ty, _Dx >::operator= ( _Myt &&  _Right)
inline
1378  { // assign by moving _Right
1379  if (this != &_Right)
1380  { // different, do the move
1381  reset(_Right.release());
1382  this->get_deleter() = _STD forward<_Dx>(_Right.get_deleter());
1383  }
1384  return (*this);
1385  }
void reset(pointer _Ptr=pointer()) _NOEXCEPT
Definition: memory:1427
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
constexpr const _Ty &() _Right
Definition: algorithm:3591
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
1421  { // yield ownership of pointer
1422  pointer _Ans = get();
1423  this->_Myptr() = pointer();
1424  return (_Ans);
1425  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1261
_Mybase::pointer pointer
Definition: memory:1283
template<class _Ty, class _Dx>
void unique_ptr< _Ty, _Dx >::reset ( pointer  _Ptr = pointer())
inline
1428  { // establish new pointer
1429  pointer _Old = get();
1430  this->_Myptr() = _Ptr;
1431  if (_Old != pointer())
1432  this->get_deleter()(_Old);
1433  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1261
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
_Mybase::pointer pointer
Definition: memory:1283
template<class _Ty, class _Dx>
void unique_ptr< _Ty, _Dx >::swap ( _Myt _Right)
inline
1388  { // swap elements
1389  _Swap_adl(this->_Myptr(), _Right._Myptr());
1390  _Swap_adl(this->get_deleter(),
1391  _Right.get_deleter());
1392  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1261
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
void _Swap_adl(_Ty &_Left, _Ty &_Right) _NOEXCEPT_OP(_Is_nothrow_swappable< _Ty >
Definition: utility:56
constexpr const _Ty &() _Right
Definition: algorithm:3591

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