From Jason Turner

[ispanstream]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp_ymsmwe8/{from.md → to.md} +140 -0
tmp/tmp_ymsmwe8/{from.md → to.md} RENAMED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Class template `basic_ispanstream` <a id="ispanstream">[[ispanstream]]</a>
2
+
3
+ #### General <a id="ispanstream.general">[[ispanstream.general]]</a>
4
+
5
+ ``` cpp
6
+ namespace std {
7
+ template<class charT, class traits = char_traits<charT>>
8
+ class basic_ispanstream
9
+ : public basic_istream<charT, traits> {
10
+ public:
11
+ using char_type = charT;
12
+ using int_type = typename traits::int_type;
13
+ using pos_type = typename traits::pos_type;
14
+ using off_type = typename traits::off_type;
15
+ using traits_type = traits;
16
+
17
+ // [ispanstream.cons], constructors
18
+ explicit basic_ispanstream(std::span<charT> s,
19
+ ios_base::openmode which = ios_base::in);
20
+ basic_ispanstream(const basic_ispanstream&) = delete;
21
+ basic_ispanstream(basic_ispanstream&& rhs);
22
+ template<class ROS> explicit basic_ispanstream(ROS&& s);
23
+
24
+ basic_ispanstream& operator=(const basic_ispanstream&) = delete;
25
+ basic_ispanstream& operator=(basic_ispanstream&& rhs);
26
+
27
+ // [ispanstream.swap], swap
28
+ void swap(basic_ispanstream& rhs);
29
+
30
+ // [ispanstream.members], member functions
31
+ basic_spanbuf<charT, traits>* rdbuf() const noexcept;
32
+
33
+ std::span<const charT> span() const noexcept;
34
+ void span(std::span<charT> s) noexcept;
35
+ template<class ROS> void span(ROS&& s) noexcept;
36
+
37
+ private:
38
+ basic_spanbuf<charT, traits> sb; // exposition only
39
+ };
40
+ }
41
+ ```
42
+
43
+ [*Note 1*: Constructing an `ispanstream` from a *string-literal*
44
+ includes the termination character `'\0'` in the underlying
45
+ `spanbuf`. — *end note*]
46
+
47
+ #### Constructors <a id="ispanstream.cons">[[ispanstream.cons]]</a>
48
+
49
+ ``` cpp
50
+ explicit basic_ispanstream(std::span<charT> s, ios_base::openmode which = ios_base::in);
51
+ ```
52
+
53
+ *Effects:* Initializes the base class with
54
+ `basic_istream<charT, traits>(addressof(sb))` and `sb` with
55
+ `basic_spanbuf<charT, traits>(s, which | ios_base::in)`
56
+ [[spanbuf.cons]].
57
+
58
+ ``` cpp
59
+ basic_ispanstream(basic_ispanstream&& rhs);
60
+ ```
61
+
62
+ *Effects:* Initializes the base class with `std::move(rhs)` and `sb`
63
+ with `std::move(rhs.sb)`. Next,
64
+ `basic_istream<charT, traits>::set_rdbuf(addressof(sb))` is called to
65
+ install the contained `basic_spanbuf`.
66
+
67
+ ``` cpp
68
+ template<class ROS> explicit basic_ispanstream(ROS&& s)
69
+ ```
70
+
71
+ *Constraints:* `ROS` models `ranges::borrowed_range`.
72
+ `!convertible_to<ROS, std::span<charT>> && convertible_to<ROS, std::span<charT const>>`
73
+ is `true`.
74
+
75
+ *Effects:* Let `sp` be `std::span<const charT>(std::forward<ROS>(s))`.
76
+ Equivalent to
77
+
78
+ ``` cpp
79
+ basic_ispanstream(std::span<charT>(const_cast<charT*>(sp.data()), sp.size()))
80
+ ```
81
+
82
+ #### Swap <a id="ispanstream.swap">[[ispanstream.swap]]</a>
83
+
84
+ ``` cpp
85
+ void swap(basic_ispanstream& rhs);
86
+ ```
87
+
88
+ *Effects:* Equivalent to:
89
+
90
+ ``` cpp
91
+ basic_istream<charT, traits>::swap(rhs);
92
+ sb.swap(rhs.sb);
93
+ ```
94
+
95
+ ``` cpp
96
+ template<class charT, class traits>
97
+ void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
98
+ ```
99
+
100
+ *Effects:* Equivalent to `x.swap(y)`.
101
+
102
+ #### Member functions <a id="ispanstream.members">[[ispanstream.members]]</a>
103
+
104
+ ``` cpp
105
+ basic_spanbuf<charT, traits>* rdbuf() const noexcept;
106
+ ```
107
+
108
+ *Effects:* Equivalent to:
109
+
110
+ ``` cpp
111
+ return const_cast<basic_spanbuf<charT, traits>*>(addressof(sb));
112
+ ```
113
+
114
+ ``` cpp
115
+ std::span<const charT> span() const noexcept;
116
+ ```
117
+
118
+ *Effects:* Equivalent to: `return rdbuf()->span();`
119
+
120
+ ``` cpp
121
+ void span(std::span<charT> s) noexcept;
122
+ ```
123
+
124
+ *Effects:* Equivalent to `rdbuf()->span(s)`.
125
+
126
+ ``` cpp
127
+ template<class ROS> void span(ROS&& s) noexcept;
128
+ ```
129
+
130
+ *Constraints:* `ROS` models `ranges::borrowed_range`.
131
+ `(!convertible_to<ROS, std::span<charT>>) && convertible_to<ROS, std::span<const charT>>`
132
+ is `true`.
133
+
134
+ *Effects:* Let `sp` be `std::span<const charT>(std::forward<ROS>(s))`.
135
+ Equivalent to:
136
+
137
+ ``` cpp
138
+ this->span(std::span<charT>(const_cast<charT*>(sp.data()), sp.size()))
139
+ ```
140
+