|
2084 | 2084 | }
|
2085 | 2085 | \end{codeblock}
|
2086 | 2086 |
|
| 2087 | +\pnum |
| 2088 | +A program that instantiates the definition of \tcode{unique_ptr<T, D>} |
| 2089 | +is ill-formed if \tcode{T*} is an invalid type. |
| 2090 | +\begin{note} |
| 2091 | +This prevents the intantiation of specializations such as |
| 2092 | +\tcode{unique_ptr<T\&, D>} and \tcode{unique_ptr<int() const, D>}. |
| 2093 | +\end{note} |
| 2094 | + |
2087 | 2095 | \pnum
|
2088 | 2096 | The default type for the template parameter \tcode{D} is
|
2089 | 2097 | \tcode{default_delete}. A client-supplied template argument
|
|
2434 | 2442 | \end{itemdecl}
|
2435 | 2443 |
|
2436 | 2444 | \begin{itemdescr}
|
| 2445 | +\pnum |
| 2446 | +\mandates |
| 2447 | +\tcode{reference_converts_from_temporary_v<add_lvalue_reference_t<T>, decltype(\linebreak{}*declval<pointer>())>} is \tcode{false}. |
| 2448 | + |
2437 | 2449 | \pnum
|
2438 | 2450 | \expects
|
2439 |
| -\tcode{get() != nullptr}. |
| 2451 | +\tcode{get() != nullptr} is \tcode{true}. |
2440 | 2452 |
|
2441 | 2453 | \pnum
|
2442 | 2454 | \returns
|
|
3970 | 3982 | \tcode{allocate_shared} shall initialize this (sub)object
|
3971 | 3983 | via the expression
|
3972 | 3984 | \begin{itemize}
|
3973 |
| - \item \tcode{allocator_traits<A2>::construct(a2, pv, v)} or |
3974 |
| - \item \tcode{allocator_traits<A2>::construct(a2, pv, l...)} |
| 3985 | + \item \tcode{allocator_traits<A2>::construct(a2, pu, v)} or |
| 3986 | + \item \tcode{allocator_traits<A2>::construct(a2, pu, l...)} |
3975 | 3987 | \end{itemize}
|
3976 | 3988 | respectively,
|
3977 |
| - where \tcode{pv} points to storage |
3978 |
| - suitable to hold an object of type \tcode{U} and |
3979 |
| - \tcode{a2} of type \tcode{A2} is a rebound copy of |
3980 |
| - the allocator \tcode{a} passed to \tcode{allocate_shared} |
3981 |
| - such that its \tcode{value_type} is \tcode{remove_cv_t<U>}. |
| 3989 | + where \tcode{pu} is a pointer of type \tcode{remove_cv_t<U>*} |
| 3990 | + pointing to storage |
| 3991 | + suitable to hold an object of type \tcode{remove_cv_t<U>} and |
| 3992 | + \tcode{a2} of type \tcode{A2} is a potentially rebound copy of |
| 3993 | + the allocator \tcode{a} passed to \tcode{allocate_shared}. |
3982 | 3994 | \item
|
3983 | 3995 | When a (sub)object of non-array type \tcode{U} is specified to have
|
3984 | 3996 | a default initial value,
|
|
3989 | 4001 | \item
|
3990 | 4002 | When a (sub)object of non-array type \tcode{U} is specified to have
|
3991 | 4003 | a default initial value,
|
3992 |
| - \tcode{allocate_shared} shall initialize this (sub)object |
3993 |
| - via the expression \tcode{allocator_traits<A2>::construct(a2, pv)}, |
3994 |
| - where \tcode{pv} points to storage |
3995 |
| - suitable to hold an object of type \tcode{U} and |
3996 |
| - \tcode{a2} of type \tcode{A2} is a rebound copy of |
3997 |
| - the allocator \tcode{a} passed to \tcode{allocate_shared} |
3998 |
| - such that its \tcode{value_type} is \tcode{remove_cv_t<U>}. |
| 4004 | + \tcode{allocate_shared} initializes this (sub)object |
| 4005 | + via the expression \tcode{allocator_traits<A2>::construct(a2, pu)}, |
| 4006 | + where \tcode{pu} is a pointer of type \tcode{remove_cv_t<U>*} |
| 4007 | + pointing to storage |
| 4008 | + suitable to hold an object of type \tcode{remove_cv_t<U>} and |
| 4009 | + \tcode{a2} of type \tcode{A2} is a potentially rebound copy of |
| 4010 | + the allocator \tcode{a} passed to \tcode{allocate_shared}. |
3999 | 4011 | \item
|
4000 | 4012 | When a (sub)object of non-array type \tcode{U} is initialized by
|
4001 | 4013 | \tcode{make_shared_for_overwrite} or\linebreak % avoid Overfull
|
|
4012 | 4024 | of their original construction.
|
4013 | 4025 | \item
|
4014 | 4026 | When a (sub)object of non-array type \tcode{U}
|
4015 |
| - that was initialized by \tcode{make_shared} is to be destroyed, |
4016 |
| - it is destroyed via the expression \tcode{pv->\~{}U()} where |
4017 |
| - \tcode{pv} points to that object of type \tcode{U}. |
| 4027 | + that was initialized by \tcode{make_shared}, |
| 4028 | + \tcode{make_shared_for_overwrite}, or \tcode{allocate_shared_for_overwrite} |
| 4029 | + is to be destroyed, |
| 4030 | + it is destroyed via the expression \tcode{pu->\~{}U()} where |
| 4031 | + \tcode{pu} points to that object of type \tcode{U}. |
4018 | 4032 | \item
|
4019 | 4033 | When a (sub)object of non-array type \tcode{U}
|
4020 | 4034 | that was initialized by \tcode{allocate_shared} is to be destroyed,
|
4021 | 4035 | it is destroyed via the expression
|
4022 |
| - \tcode{allocator_traits<A2>::destroy(a2, pv)} where |
4023 |
| - \tcode{pv} points to that object of type \tcode{remove_cv_t<U>} and |
4024 |
| - \tcode{a2} of type \tcode{A2} is a rebound copy of |
4025 |
| - the allocator \tcode{a} passed to \tcode{allocate_shared} |
4026 |
| - such that its \tcode{value_type} is \tcode{remove_cv_t<U>}. |
| 4036 | + \tcode{allocator_traits<A2>::destroy(a2, pu)} where |
| 4037 | + \tcode{pu} is a pointer of type \tcode{remove_cv_t<U>*} |
| 4038 | + pointing to that object of type \tcode{remove_cv_t<U>} and |
| 4039 | + \tcode{a2} of type \tcode{A2} is a potentially rebound copy of |
| 4040 | + the allocator \tcode{a} passed to \tcode{allocate_shared}. |
4027 | 4041 | \end{itemize}
|
4028 | 4042 | \begin{note}
|
4029 | 4043 | These functions will typically allocate more memory than \tcode{sizeof(T)} to
|
|
0 commit comments