[unique.ptr.runtime.ctor] (original) (raw)
20 Memory management library [mem]
20.3 Smart pointers [smartptr]
20.3.1 Unique-ownership pointers [unique.ptr]
20.3.1.4 unique_ptr for array objects with a runtime length [unique.ptr.runtime]
20.3.1.4.2 Constructors [unique.ptr.runtime.ctor]
template<class U> constexpr explicit unique_ptr(U p) noexcept;
This constructor behaves the same as the constructor in the primary template that takes a single parameter of type pointer.
Constraints:
- U is the same type as pointer, or
- pointer is the same type as element_type*,U is a pointer type V*, andV(*)[] is convertible to element_type(*)[].
template<class U> constexpr unique_ptr(U p, _see below_ d) noexcept;template<class U> constexpr unique_ptr(U p, _see below_ d) noexcept;
These constructors behave the same as the constructors in the primary template that take a parameter of type pointer and a second parameter.
Constraints:
- U is the same type as pointer,
- U is nullptr_t, or
- pointer is the same type as element_type*,U is a pointer type V*, andV(*)[] is convertible to element_type(*)[].
template<class U, class E> constexpr unique_ptr(unique_ptr<U, E>&& u) noexcept;
This constructor behaves the same as in the primary template.
Constraints: Where UP is unique_ptr<U, E>:
- U is an array type, and
- pointer is the same type as element_type*, and
- UP::pointer is the same type as UP::element_type*, and
- UP::element_type(*)[] is convertible to element_type(*)[], and
- either D is a reference type and E is the same type as D, or D is not a reference type and E is implicitly convertible to D.
[Note 1:
This replaces the Constraints: specification of the primary template.
— _end note_]