From Jason Turner

[range.semi.wrap]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1u_te13p/{from.md → to.md} +38 -0
tmp/tmp1u_te13p/{from.md → to.md} RENAMED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Semiregular wrapper <a id="range.semi.wrap">[[range.semi.wrap]]</a>
2
+
3
+ Many types in this subclause are specified in terms of an
4
+ exposition-only class template *`semiregular-box`*. `semiregular-box<T>`
5
+ behaves exactly like `optional<T>` with the following differences:
6
+
7
+ - `semiregular-box<T>` constrains its type parameter `T` with
8
+ `copy_constructible<T> && is_object_v<T>`.
9
+ - If `T` models `default_initializable`, the default constructor of
10
+ `semiregular-box<T>` is equivalent to:
11
+ ``` cpp
12
+ constexpr semiregular-box() noexcept(is_nothrow_default_constructible_v<T>)
13
+ : semiregular-box{in_place}
14
+ { }
15
+ ```
16
+ - If `assignable_from<T&, const T&>` is not modeled, the copy assignment
17
+ operator is equivalent to:
18
+ ``` cpp
19
+ semiregular-box& operator=(const semiregular-box& that)
20
+ noexcept(is_nothrow_copy_constructible_v<T>)
21
+ {
22
+ if (that) emplace(*that);
23
+ else reset();
24
+ return *this;
25
+ }
26
+ ```
27
+ - If `assignable_from<T&, T>` is not modeled, the move assignment
28
+ operator is equivalent to:
29
+ ``` cpp
30
+ semiregular-box& operator=(semiregular-box&& that)
31
+ noexcept(is_nothrow_move_constructible_v<T>)
32
+ {
33
+ if (that) emplace(std::move(*that));
34
+ else reset();
35
+ return *this;
36
+ }
37
+ ```
38
+