Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
unique_ptr.hpp File Reference

Describes the smart pointer unique_ptr, a drop-in replacement for std::unique_ptr, usable also from C++03 compilers. More...

#include <boost/move/detail/config_begin.hpp>
#include <boost/move/detail/workaround.hpp>
#include <boost/move/detail/unique_ptr_meta_utils.hpp>
#include <boost/move/default_delete.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/static_assert.hpp>
#include <boost/assert.hpp>
#include <cstddef>
#include <boost/move/detail/config_end.hpp>
Include dependency graph for unique_ptr.hpp:
This graph shows which files directly or indirectly include this file:

Classes

struct  boost::move_upd::deleter_types< D >
 
struct  boost::move_upd::unique_ptr_data< P, D, bool >
 
struct  boost::move_upd::unique_ptr_data< P, D, false >
 
struct  boost::move_upd::get_element_type< T >
 
struct  boost::move_upd::get_element_type< T >::DefaultWrap
 
struct  boost::move_upd::get_element_type< T * >
 
struct  boost::move_upd::get_cvelement< T >
 
struct  boost::move_upd::is_same_cvelement_and_convertible< P1, P2 >
 
struct  boost::move_upd::is_unique_ptr_convertible< IsArray, FromPointer, ThisPointer >
 
struct  boost::move_upd::is_unique_ptr_convertible< false, FromPointer, ThisPointer >
 
struct  boost::move_upd::enable_up_ptr< T, FromPointer, ThisPointer, Type >
 
struct  boost::move_upd::unique_moveconvert_assignable< T, D, U, E >
 
struct  boost::move_upd::unique_moveconvert_assignable< T[], D, U[N], E >
 
struct  boost::move_upd::enable_up_moveconv_assign< T, D, U, E, Type >
 
struct  boost::move_upd::unique_deleter_is_initializable< D, E, IsReference >
 
class  boost::move_upd::is_rvalue_convertible< T, U >
 
struct  boost::move_upd::unique_deleter_is_initializable< D, E, false >
 
struct  boost::move_upd::enable_up_moveconv_constr< T, D, U, E, Type >
 
class  boost::movelib::unique_ptr< T, D >
 A unique pointer is an object that owns another object and manages that other object through a pointer. More...
 

Namespaces

 boost
 Duration formatting facet for input.
 
 boost::move_upd
 
 boost::movelib
 

Functions

template<class T , class D >
void boost::movelib::swap (unique_ptr< T, D > &x, unique_ptr< T, D > &y) BOOST_NOEXCEPT
 Effects: Calls x.swap(y). More...
 
template<class T1 , class D1 , class T2 , class D2 >
bool boost::movelib::operator== (const unique_ptr< T1, D1 > &x, const unique_ptr< T2, D2 > &y)
 Returns: x.get() == y.get(). More...
 
template<class T1 , class D1 , class T2 , class D2 >
bool boost::movelib::operator!= (const unique_ptr< T1, D1 > &x, const unique_ptr< T2, D2 > &y)
 Returns: x.get() != y.get(). More...
 
template<class T1 , class D1 , class T2 , class D2 >
bool boost::movelib::operator< (const unique_ptr< T1, D1 > &x, const unique_ptr< T2, D2 > &y)
 Returns: x.get() < y.get(). More...
 
template<class T1 , class D1 , class T2 , class D2 >
bool boost::movelib::operator<= (const unique_ptr< T1, D1 > &x, const unique_ptr< T2, D2 > &y)
 Returns: !(y < x). More...
 
template<class T1 , class D1 , class T2 , class D2 >
bool boost::movelib::operator> (const unique_ptr< T1, D1 > &x, const unique_ptr< T2, D2 > &y)
 Returns: y < x. More...
 
template<class T1 , class D1 , class T2 , class D2 >
bool boost::movelib::operator>= (const unique_ptr< T1, D1 > &x, const unique_ptr< T2, D2 > &y)
 Returns:!(x < y). More...
 
template<class T , class D >
bool boost::movelib::operator== (const unique_ptr< T, D > &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) BOOST_NOEXCEPT
 Returns:!x. More...
 
template<class T , class D >
bool boost::movelib::operator== (BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr< T, D > &x) BOOST_NOEXCEPT
 Returns:!x. More...
 
template<class T , class D >
bool boost::movelib::operator!= (const unique_ptr< T, D > &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) BOOST_NOEXCEPT
 Returns: (bool)x. More...
 
template<class T , class D >
bool boost::movelib::operator!= (BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr< T, D > &x) BOOST_NOEXCEPT
 Returns: (bool)x. More...
 
template<class T , class D >
bool boost::movelib::operator< (const unique_ptr< T, D > &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type))
 Requires: operator shall induce a strict weak ordering on unique_ptr<T, D>::pointer values. More...
 
template<class T , class D >
bool boost::movelib::operator< (BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr< T, D > &x)
 Requires: operator shall induce a strict weak ordering on unique_ptr<T, D>::pointer values. More...
 
template<class T , class D >
bool boost::movelib::operator> (const unique_ptr< T, D > &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type))
 Returns: nullptr < x. More...
 
template<class T , class D >
bool boost::movelib::operator> (BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr< T, D > &x)
 Returns: x < nullptr. More...
 
template<class T , class D >
bool boost::movelib::operator<= (const unique_ptr< T, D > &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type))
 Returns: !(nullptr < x). More...
 
template<class T , class D >
bool boost::movelib::operator<= (BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr< T, D > &x)
 Returns: !(x < nullptr). More...
 
template<class T , class D >
bool boost::movelib::operator>= (const unique_ptr< T, D > &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type))
 Returns: !(x < nullptr). More...
 
template<class T , class D >
bool boost::movelib::operator>= (BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr< T, D > &x)
 Returns: !(nullptr < x). More...
 

Detailed Description

Describes the smart pointer unique_ptr, a drop-in replacement for std::unique_ptr, usable also from C++03 compilers.

Main differences from std::unique_ptr to avoid heavy dependencies, specially in C++03 compilers:

  • operator < uses pointer operator < instead of std::less<common_type>. This avoids dependencies on std::common_type and std::less (<type_traits>/<functional> headers. In C++03 this avoid pulling Boost.Typeof and other cascading dependencies. As in all Boost platforms operator < on raw pointers and other smart pointers provides strict weak ordering in practice this should not be a problem for users.
  • assignable from literal 0 for compilers without nullptr
  • unique_ptr<T[]> is constructible and assignable from unique_ptr<U[]> if cv-less T and cv-less U are the same type and T is more CV qualified than U.