From Jason Turner

[range.single.view]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpvg81h61x/{from.md → to.md} +75 -0
tmp/tmpvg81h61x/{from.md → to.md} RENAMED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class template `single_view` <a id="range.single.view">[[range.single.view]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::ranges {
5
+ template<copy_constructible T>
6
+ requires is_object_v<T>
7
+ class single_view : public view_interface<single_view<T>> {
8
+ private:
9
+ semiregular-box<T> value_; // exposition only{} (see [range.semi.wrap])
10
+ public:
11
+ single_view() = default;
12
+ constexpr explicit single_view(const T& t);
13
+ constexpr explicit single_view(T&& t);
14
+ template<class... Args>
15
+ requires constructible_from<T, Args...>
16
+ constexpr single_view(in_place_t, Args&&... args);
17
+
18
+ constexpr T* begin() noexcept;
19
+ constexpr const T* begin() const noexcept;
20
+ constexpr T* end() noexcept;
21
+ constexpr const T* end() const noexcept;
22
+ static constexpr size_t size() noexcept;
23
+ constexpr T* data() noexcept;
24
+ constexpr const T* data() const noexcept;
25
+ };
26
+ }
27
+ ```
28
+
29
+ ``` cpp
30
+ constexpr explicit single_view(const T& t);
31
+ ```
32
+
33
+ *Effects:* Initializes *value\_* with `t`.
34
+
35
+ ``` cpp
36
+ constexpr explicit single_view(T&& t);
37
+ ```
38
+
39
+ *Effects:* Initializes *value\_* with `std::move(t)`.
40
+
41
+ ``` cpp
42
+ template<class... Args>
43
+ constexpr single_view(in_place_t, Args&&... args);
44
+ ```
45
+
46
+ *Effects:* Initializes *value\_* as if by
47
+ *`value_`*`{in_place, std::forward<Args>(args)...}`.
48
+
49
+ ``` cpp
50
+ constexpr T* begin() noexcept;
51
+ constexpr const T* begin() const noexcept;
52
+ ```
53
+
54
+ *Effects:* Equivalent to: `return data();`
55
+
56
+ ``` cpp
57
+ constexpr T* end() noexcept;
58
+ constexpr const T* end() const noexcept;
59
+ ```
60
+
61
+ *Effects:* Equivalent to: `return data() + 1;`
62
+
63
+ ``` cpp
64
+ static constexpr size_t size() noexcept;
65
+ ```
66
+
67
+ *Effects:* Equivalent to: `return 1;`
68
+
69
+ ``` cpp
70
+ constexpr T* data() noexcept;
71
+ constexpr const T* data() const noexcept;
72
+ ```
73
+
74
+ *Effects:* Equivalent to: `return `*`value_`*`.operator->();`
75
+