From Jason Turner

[template.bitset]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpnwvpmx1o/{from.md → to.md} +23 -10
tmp/tmpnwvpmx1o/{from.md → to.md} RENAMED
@@ -6,13 +6,10 @@
6
  namespace std {
7
  template<size_t N> class bitset {
8
  public:
9
  // bit reference
10
  class reference {
11
- friend class bitset;
12
- constexpr reference() noexcept;
13
-
14
  public:
15
  constexpr reference(const reference&) = default;
16
  constexpr ~reference();
17
  constexpr reference& operator=(bool x) noexcept; // for b[i] = x;
18
  constexpr reference& operator=(const reference&) noexcept; // for b[i] = b[j];
@@ -30,14 +27,22 @@ namespace std {
30
  typename basic_string<charT, traits, Allocator>::size_type pos = 0,
31
  typename basic_string<charT, traits, Allocator>::size_type n
32
  = basic_string<charT, traits, Allocator>::npos,
33
  charT zero = charT('0'),
34
  charT one = charT('1'));
 
 
 
 
 
 
 
 
35
  template<class charT>
36
  constexpr explicit bitset(
37
  const charT* str,
38
- typename basic_string<charT>::size_type n = basic_string<charT>::npos,
39
  charT zero = charT('0'),
40
  charT one = charT('1'));
41
 
42
  // [bitset.members], bitset operations
43
  constexpr bitset& operator&=(const bitset& rhs) noexcept;
@@ -129,10 +134,18 @@ template<class charT, class traits, class Allocator>
129
  typename basic_string<charT, traits, Allocator>::size_type pos = 0,
130
  typename basic_string<charT, traits, Allocator>::size_type n
131
  = basic_string<charT, traits, Allocator>::npos,
132
  charT zero = charT('0'),
133
  charT one = charT('1'));
 
 
 
 
 
 
 
 
134
  ```
135
 
136
  *Effects:* Determines the effective length `rlen` of the initializing
137
  string as the smaller of `n` and `str.size() - pos`. Initializes the
138
  first `M` bit positions to values determined from the corresponding
@@ -154,21 +167,21 @@ other than `zero` or `one`.
154
 
155
  ``` cpp
156
  template<class charT>
157
  constexpr explicit bitset(
158
  const charT* str,
159
- typename basic_string<charT>::size_type n = basic_string<charT>::npos,
160
  charT zero = charT('0'),
161
  charT one = charT('1'));
162
  ```
163
 
164
  *Effects:* As if by:
165
 
166
  ``` cpp
167
- bitset(n == basic_string<charT>::npos
168
- ? basic_string<charT>(str)
169
- : basic_string<charT>(str, n),
170
  0, n, zero, one)
171
  ```
172
 
173
  #### Members <a id="bitset.members">[[bitset.members]]</a>
174
 
@@ -306,22 +319,22 @@ position.
306
 
307
  ``` cpp
308
  constexpr bool operator[](size_t pos) const;
309
  ```
310
 
311
- *Preconditions:* `pos` is valid.
312
 
313
  *Returns:* `true` if the bit at position `pos` in `*this` has the value
314
  one, otherwise `false`.
315
 
316
  *Throws:* Nothing.
317
 
318
  ``` cpp
319
  constexpr bitset::reference operator[](size_t pos);
320
  ```
321
 
322
- *Preconditions:* `pos` is valid.
323
 
324
  *Returns:* An object of type `bitset::reference` such that
325
  `(*this)[pos] == this->test(pos)`, and such that `(*this)[pos] = val` is
326
  equivalent to `this->set(pos, val)`.
327
 
 
6
  namespace std {
7
  template<size_t N> class bitset {
8
  public:
9
  // bit reference
10
  class reference {
 
 
 
11
  public:
12
  constexpr reference(const reference&) = default;
13
  constexpr ~reference();
14
  constexpr reference& operator=(bool x) noexcept; // for b[i] = x;
15
  constexpr reference& operator=(const reference&) noexcept; // for b[i] = b[j];
 
27
  typename basic_string<charT, traits, Allocator>::size_type pos = 0,
28
  typename basic_string<charT, traits, Allocator>::size_type n
29
  = basic_string<charT, traits, Allocator>::npos,
30
  charT zero = charT('0'),
31
  charT one = charT('1'));
32
+ template<class charT, class traits>
33
+ constexpr explicit bitset(
34
+ basic_string_view<charT, traits> str,
35
+ typename basic_string_view<charT, traits>::size_type pos = 0,
36
+ typename basic_string_view<charT, traits>::size_type n
37
+ = basic_string_view<charT, traits>::npos,
38
+ charT zero = charT('0'),
39
+ charT one = charT('1'));
40
  template<class charT>
41
  constexpr explicit bitset(
42
  const charT* str,
43
+ typename basic_string_view<charT>::size_type n = basic_string_view<charT>::npos,
44
  charT zero = charT('0'),
45
  charT one = charT('1'));
46
 
47
  // [bitset.members], bitset operations
48
  constexpr bitset& operator&=(const bitset& rhs) noexcept;
 
134
  typename basic_string<charT, traits, Allocator>::size_type pos = 0,
135
  typename basic_string<charT, traits, Allocator>::size_type n
136
  = basic_string<charT, traits, Allocator>::npos,
137
  charT zero = charT('0'),
138
  charT one = charT('1'));
139
+ template<class charT, class traits>
140
+ constexpr explicit bitset(
141
+ basic_string_view<charT, traits> str,
142
+ typename basic_string_view<charT, traits>::size_type pos = 0,
143
+ typename basic_string_view<charT, traits>::size_type n
144
+ = basic_string_view<charT, traits>::npos,
145
+ charT zero = charT('0'),
146
+ charT one = charT('1'));
147
  ```
148
 
149
  *Effects:* Determines the effective length `rlen` of the initializing
150
  string as the smaller of `n` and `str.size() - pos`. Initializes the
151
  first `M` bit positions to values determined from the corresponding
 
167
 
168
  ``` cpp
169
  template<class charT>
170
  constexpr explicit bitset(
171
  const charT* str,
172
+ typename basic_string_view<charT>::size_type n = basic_string_view<charT>::npos,
173
  charT zero = charT('0'),
174
  charT one = charT('1'));
175
  ```
176
 
177
  *Effects:* As if by:
178
 
179
  ``` cpp
180
+ bitset(n == basic_string_view<charT>::npos
181
+ ? basic_string_view<charT>(str)
182
+ : basic_string_view<charT>(str, n),
183
  0, n, zero, one)
184
  ```
185
 
186
  #### Members <a id="bitset.members">[[bitset.members]]</a>
187
 
 
319
 
320
  ``` cpp
321
  constexpr bool operator[](size_t pos) const;
322
  ```
323
 
324
+ `pos < size()` is `true`.
325
 
326
  *Returns:* `true` if the bit at position `pos` in `*this` has the value
327
  one, otherwise `false`.
328
 
329
  *Throws:* Nothing.
330
 
331
  ``` cpp
332
  constexpr bitset::reference operator[](size_t pos);
333
  ```
334
 
335
+ `pos < size()` is `true`.
336
 
337
  *Returns:* An object of type `bitset::reference` such that
338
  `(*this)[pos] == this->test(pos)`, and such that `(*this)[pos] = val` is
339
  equivalent to `this->set(pos, val)`.
340