From Jason Turner

[unique.ptr.runtime.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpfx4ygb_1/{from.md → to.md} +67 -0
tmp/tmpfx4ygb_1/{from.md → to.md} RENAMED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##### General <a id="unique.ptr.runtime.general">[[unique.ptr.runtime.general]]</a>
2
+
3
+ ``` cpp
4
+ namespace std {
5
+ template<class T, class D> class unique_ptr<T[], D> {
6
+ public:
7
+ using pointer = see below;
8
+ using element_type = T;
9
+ using deleter_type = D;
10
+
11
+ // [unique.ptr.runtime.ctor], constructors
12
+ constexpr unique_ptr() noexcept;
13
+ template<class U> constexpr explicit unique_ptr(U p) noexcept;
14
+ template<class U> constexpr unique_ptr(U p, see below d) noexcept;
15
+ template<class U> constexpr unique_ptr(U p, see below d) noexcept;
16
+ constexpr unique_ptr(unique_ptr&& u) noexcept;
17
+ template<class U, class E>
18
+ constexpr unique_ptr(unique_ptr<U, E>&& u) noexcept;
19
+ constexpr unique_ptr(nullptr_t) noexcept;
20
+
21
+ // destructor
22
+ constexpr ~unique_ptr();
23
+
24
+ // 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.runtime.observers], observers
31
+ constexpr T& operator[](size_t i) const;
32
+ constexpr pointer get() const noexcept;
33
+ constexpr deleter_type& get_deleter() noexcept;
34
+ constexpr const deleter_type& get_deleter() const noexcept;
35
+ constexpr explicit operator bool() const noexcept;
36
+
37
+ // [unique.ptr.runtime.modifiers], modifiers
38
+ constexpr pointer release() noexcept;
39
+ template<class U> constexpr void reset(U p) noexcept;
40
+ constexpr void reset(nullptr_t = nullptr) 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
+ A specialization for array types is provided with a slightly altered
51
+ interface.
52
+
53
+ - Conversions between different types of `unique_ptr<T[], D>` that would
54
+ be disallowed for the corresponding pointer-to-array types, and
55
+ conversions to or from the non-array forms of `unique_ptr`, produce an
56
+ ill-formed program.
57
+ - Pointers to types derived from `T` are rejected by the constructors,
58
+ and by `reset`.
59
+ - The observers `operator*` and `operator->` are not provided.
60
+ - The indexing observer `operator[]` is provided.
61
+ - The default deleter will call `delete[]`.
62
+
63
+ Descriptions are provided below only for members that differ from the
64
+ primary template.
65
+
66
+ The template argument `T` shall be a complete type.
67
+