| 352 | //! - If the type <tt>remove_reference<D>::type::pointer</tt> exists, it shall satisfy the requirements of NullablePointer. |
| 353 | template <class T, class D = default_delete<T> > |
| 354 | class unique_ptr |
| 355 | { |
| 356 | #if defined(BOOST_MOVE_DOXYGEN_INVOKED) |
| 357 | public: |
| 358 | unique_ptr(const unique_ptr&) = delete; |
| 359 | unique_ptr& operator=(const unique_ptr&) = delete; |
| 360 | private: |
| 361 | #else |
| 362 | BOOST_MOVABLE_BUT_NOT_COPYABLE(unique_ptr) |
| 363 | |
| 364 | typedef bmupmu::pointer_type<T, D > pointer_type_obtainer; |
| 365 | typedef bmupd::unique_ptr_data |
| 366 | <typename pointer_type_obtainer::type, D> data_type; |
| 367 | typedef typename bmupd::deleter_types<D>::deleter_arg_type1 deleter_arg_type1; |
| 368 | typedef typename bmupd::deleter_types<D>::deleter_arg_type2 deleter_arg_type2; |
| 369 | data_type m_data; |
| 370 | #endif |
| 371 | |
| 372 | public: |
| 373 | //! If the type <tt>remove_reference<D>::type::pointer</tt> exists, then it shall be a |
| 374 | //! synonym for <tt>remove_reference<D>::type::pointer</tt>. Otherwise it shall be a |
| 375 | //! synonym for T*. |
| 376 | typedef typename BOOST_MOVE_SEEDOC(pointer_type_obtainer::type) pointer; |
| 377 | //! If T is an array type, then element_type is equal to T. Otherwise, if T is a type |
| 378 | //! in the form U[], element_type is equal to U. |
| 379 | typedef typename BOOST_MOVE_SEEDOC(bmupmu::remove_extent<T>::type) element_type; |
| 380 | typedef D deleter_type; |
| 381 | |
| 382 | //! <b>Requires</b>: D shall satisfy the requirements of DefaultConstructible, and |
| 383 | //! that construction shall not throw an exception. |
| 384 | //! |
| 385 | //! <b>Effects</b>: Constructs a unique_ptr object that owns nothing, value-initializing the |
| 386 | //! stored pointer and the stored deleter. |
| 387 | //! |
| 388 | //! <b>Postconditions</b>: <tt>get() == nullptr</tt>. <tt>get_deleter()</tt> returns a reference to the stored deleter. |
| 389 | //! |
| 390 | //! <b>Remarks</b>: If this constructor is instantiated with a pointer type or reference type |
| 391 | //! for the template argument D, the program is ill-formed. |
| 392 | BOOST_MOVE_FORCEINLINE BOOST_CONSTEXPR unique_ptr() BOOST_NOEXCEPT |
| 393 | : m_data() |
| 394 | { |
| 395 | //If this constructor is instantiated with a pointer type or reference type |
| 396 | //for the template argument D, the program is ill-formed. |
| 397 | BOOST_STATIC_ASSERT(!bmupmu::is_pointer<D>::value); |
| 398 | BOOST_STATIC_ASSERT(!bmupmu::is_reference<D>::value); |
| 399 | } |
| 400 | |
| 401 | //! <b>Effects</b>: Same as <tt>unique_ptr()</tt> (default constructor). |
| 402 | //! |
| 403 | BOOST_MOVE_FORCEINLINE BOOST_CONSTEXPR unique_ptr(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) BOOST_NOEXCEPT |
| 404 | : m_data() |
| 405 | { |
| 406 | //If this constructor is instantiated with a pointer type or reference type |
| 407 | //for the template argument D, the program is ill-formed. |
| 408 | BOOST_STATIC_ASSERT(!bmupmu::is_pointer<D>::value); |
| 409 | BOOST_STATIC_ASSERT(!bmupmu::is_reference<D>::value); |
| 410 | } |
| 411 | |