From Jason Turner

[unique.ptr.single]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwbj60591/{from.md → to.md} +11 -1
tmp/tmpwbj60591/{from.md → to.md} RENAMED
@@ -47,10 +47,16 @@ namespace std {
47
  unique_ptr& operator=(const unique_ptr&) = delete;
48
  };
49
  }
50
  ```
51
 
 
 
 
 
 
 
52
  The default type for the template parameter `D` is `default_delete`. A
53
  client-supplied template argument `D` shall be a function object type
54
  [[function.objects]], lvalue reference to function, or lvalue reference
55
  to function object type for which, given a value `d` of type `D` and a
56
  value `ptr` of type `unique_ptr<T, D>::pointer`, the expression `d(ptr)`
@@ -275,11 +281,15 @@ constexpr unique_ptr& operator=(nullptr_t) noexcept;
275
 
276
  ``` cpp
277
  constexpr add_lvalue_reference_t<T> operator*() const noexcept(noexcept(*declval<pointer>()));
278
  ```
279
 
280
- *Preconditions:* `get() != nullptr`.
 
 
 
 
281
 
282
  *Returns:* `*get()`.
283
 
284
  ``` cpp
285
  constexpr pointer operator->() const noexcept;
 
47
  unique_ptr& operator=(const unique_ptr&) = delete;
48
  };
49
  }
50
  ```
51
 
52
+ A program that instantiates the definition of `unique_ptr<T, D>` is
53
+ ill-formed if `T*` is an invalid type.
54
+
55
+ [*Note 1*: This prevents the instantiation of specializations such as
56
+ `unique_ptr<T&, D>` and `unique_ptr<int() const, D>`. — *end note*]
57
+
58
  The default type for the template parameter `D` is `default_delete`. A
59
  client-supplied template argument `D` shall be a function object type
60
  [[function.objects]], lvalue reference to function, or lvalue reference
61
  to function object type for which, given a value `d` of type `D` and a
62
  value `ptr` of type `unique_ptr<T, D>::pointer`, the expression `d(ptr)`
 
281
 
282
  ``` cpp
283
  constexpr add_lvalue_reference_t<T> operator*() const noexcept(noexcept(*declval<pointer>()));
284
  ```
285
 
286
+ *Mandates:*
287
+ `reference_converts_from_temporary_v<add_lvalue_reference_t<T>, decltype(*declval<pointer>())>`
288
+ is `false`.
289
+
290
+ *Preconditions:* `get() != nullptr` is `true`.
291
 
292
  *Returns:* `*get()`.
293
 
294
  ``` cpp
295
  constexpr pointer operator->() const noexcept;