tmp/tmpqjt5zxvd/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##### General <a id="unique.ptr.single.general">[[unique.ptr.single.general]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std {
|
| 5 |
+
template<class T, class D = default_delete<T>> class unique_ptr {
|
| 6 |
+
public:
|
| 7 |
+
using pointer = see below;
|
| 8 |
+
using element_type = T;
|
| 9 |
+
using deleter_type = D;
|
| 10 |
+
|
| 11 |
+
// [unique.ptr.single.ctor], constructors
|
| 12 |
+
constexpr unique_ptr() noexcept;
|
| 13 |
+
constexpr explicit unique_ptr(type_identity_t<pointer> p) noexcept;
|
| 14 |
+
constexpr unique_ptr(type_identity_t<pointer> p, see below d1) noexcept;
|
| 15 |
+
constexpr unique_ptr(type_identity_t<pointer> p, see below d2) noexcept;
|
| 16 |
+
constexpr unique_ptr(unique_ptr&& u) noexcept;
|
| 17 |
+
constexpr unique_ptr(nullptr_t) noexcept;
|
| 18 |
+
template<class U, class E>
|
| 19 |
+
constexpr unique_ptr(unique_ptr<U, E>&& u) noexcept;
|
| 20 |
+
|
| 21 |
+
// [unique.ptr.single.dtor], destructor
|
| 22 |
+
constexpr ~unique_ptr();
|
| 23 |
+
|
| 24 |
+
// [unique.ptr.single.asgn], assignment
|
| 25 |
+
constexpr unique_ptr& operator=(unique_ptr&& u) noexcept;
|
| 26 |
+
template<class U, class E>
|
| 27 |
+
constexpr unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;
|
| 28 |
+
constexpr unique_ptr& operator=(nullptr_t) noexcept;
|
| 29 |
+
|
| 30 |
+
// [unique.ptr.single.observers], observers
|
| 31 |
+
constexpr add_lvalue_reference_t<T> operator*() const noexcept(see below);
|
| 32 |
+
constexpr pointer operator->() const noexcept;
|
| 33 |
+
constexpr pointer get() const noexcept;
|
| 34 |
+
constexpr deleter_type& get_deleter() noexcept;
|
| 35 |
+
constexpr const deleter_type& get_deleter() const noexcept;
|
| 36 |
+
constexpr explicit operator bool() const noexcept;
|
| 37 |
+
|
| 38 |
+
// [unique.ptr.single.modifiers], modifiers
|
| 39 |
+
constexpr pointer release() noexcept;
|
| 40 |
+
constexpr void reset(pointer p = pointer()) noexcept;
|
| 41 |
+
constexpr void swap(unique_ptr& u) noexcept;
|
| 42 |
+
|
| 43 |
+
// disable copy from lvalue
|
| 44 |
+
unique_ptr(const unique_ptr&) = delete;
|
| 45 |
+
unique_ptr& operator=(const unique_ptr&) = delete;
|
| 46 |
+
};
|
| 47 |
+
}
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
The default type for the template parameter `D` is `default_delete`. A
|
| 51 |
+
client-supplied template argument `D` shall be a function object type
|
| 52 |
+
[[function.objects]], lvalue reference to function, or lvalue reference
|
| 53 |
+
to function object type for which, given a value `d` of type `D` and a
|
| 54 |
+
value `ptr` of type `unique_ptr<T, D>::pointer`, the expression `d(ptr)`
|
| 55 |
+
is valid and has the effect of disposing of the pointer as appropriate
|
| 56 |
+
for that deleter.
|
| 57 |
+
|
| 58 |
+
If the deleter’s type `D` is not a reference type, `D` shall meet the
|
| 59 |
+
*Cpp17Destructible* requirements ([[cpp17.destructible]]).
|
| 60 |
+
|
| 61 |
+
If the *qualified-id* `remove_reference_t<D>::pointer` is valid and
|
| 62 |
+
denotes a type [[temp.deduct]], then `unique_ptr<T,
|
| 63 |
+
D>::pointer` shall be a synonym for `remove_reference_t<D>::pointer`.
|
| 64 |
+
Otherwise `unique_ptr<T, D>::pointer` shall be a synonym for
|
| 65 |
+
`element_type*`. The type `unique_ptr<T,
|
| 66 |
+
D>::pointer` shall meet the *Cpp17NullablePointer* requirements (
|
| 67 |
+
[[cpp17.nullablepointer]]).
|
| 68 |
+
|
| 69 |
+
[*Example 1*: Given an allocator type `X`
|
| 70 |
+
[[allocator.requirements.general]] and letting `A` be a synonym for
|
| 71 |
+
`allocator_traits<X>`, the types `A::pointer`, `A::const_pointer`,
|
| 72 |
+
`A::void_pointer`, and `A::const_void_pointer` may be used as
|
| 73 |
+
`unique_ptr<T, D>::pointer`. — *end example*]
|
| 74 |
+
|