From Jason Turner

[bitset]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpfk_p62w1/{from.md → to.md} +23 -10
tmp/tmpfk_p62w1/{from.md → to.md} RENAMED
@@ -37,13 +37,10 @@ namespace std {
37
  namespace std {
38
  template<size_t N> class bitset {
39
  public:
40
  // bit reference
41
  class reference {
42
- friend class bitset;
43
- constexpr reference() noexcept;
44
-
45
  public:
46
  constexpr reference(const reference&) = default;
47
  constexpr ~reference();
48
  constexpr reference& operator=(bool x) noexcept; // for b[i] = x;
49
  constexpr reference& operator=(const reference&) noexcept; // for b[i] = b[j];
@@ -61,14 +58,22 @@ namespace std {
61
  typename basic_string<charT, traits, Allocator>::size_type pos = 0,
62
  typename basic_string<charT, traits, Allocator>::size_type n
63
  = basic_string<charT, traits, Allocator>::npos,
64
  charT zero = charT('0'),
65
  charT one = charT('1'));
 
 
 
 
 
 
 
 
66
  template<class charT>
67
  constexpr explicit bitset(
68
  const charT* str,
69
- typename basic_string<charT>::size_type n = basic_string<charT>::npos,
70
  charT zero = charT('0'),
71
  charT one = charT('1'));
72
 
73
  // [bitset.members], bitset operations
74
  constexpr bitset& operator&=(const bitset& rhs) noexcept;
@@ -160,10 +165,18 @@ template<class charT, class traits, class Allocator>
160
  typename basic_string<charT, traits, Allocator>::size_type pos = 0,
161
  typename basic_string<charT, traits, Allocator>::size_type n
162
  = basic_string<charT, traits, Allocator>::npos,
163
  charT zero = charT('0'),
164
  charT one = charT('1'));
 
 
 
 
 
 
 
 
165
  ```
166
 
167
  *Effects:* Determines the effective length `rlen` of the initializing
168
  string as the smaller of `n` and `str.size() - pos`. Initializes the
169
  first `M` bit positions to values determined from the corresponding
@@ -185,21 +198,21 @@ other than `zero` or `one`.
185
 
186
  ``` cpp
187
  template<class charT>
188
  constexpr explicit bitset(
189
  const charT* str,
190
- typename basic_string<charT>::size_type n = basic_string<charT>::npos,
191
  charT zero = charT('0'),
192
  charT one = charT('1'));
193
  ```
194
 
195
  *Effects:* As if by:
196
 
197
  ``` cpp
198
- bitset(n == basic_string<charT>::npos
199
- ? basic_string<charT>(str)
200
- : basic_string<charT>(str, n),
201
  0, n, zero, one)
202
  ```
203
 
204
  #### Members <a id="bitset.members">[[bitset.members]]</a>
205
 
@@ -337,22 +350,22 @@ position.
337
 
338
  ``` cpp
339
  constexpr bool operator[](size_t pos) const;
340
  ```
341
 
342
- *Preconditions:* `pos` is valid.
343
 
344
  *Returns:* `true` if the bit at position `pos` in `*this` has the value
345
  one, otherwise `false`.
346
 
347
  *Throws:* Nothing.
348
 
349
  ``` cpp
350
  constexpr bitset::reference operator[](size_t pos);
351
  ```
352
 
353
- *Preconditions:* `pos` is valid.
354
 
355
  *Returns:* An object of type `bitset::reference` such that
356
  `(*this)[pos] == this->test(pos)`, and such that `(*this)[pos] = val` is
357
  equivalent to `this->set(pos, val)`.
358
 
 
37
  namespace std {
38
  template<size_t N> class bitset {
39
  public:
40
  // bit reference
41
  class reference {
 
 
 
42
  public:
43
  constexpr reference(const reference&) = default;
44
  constexpr ~reference();
45
  constexpr reference& operator=(bool x) noexcept; // for b[i] = x;
46
  constexpr reference& operator=(const reference&) noexcept; // for b[i] = b[j];
 
58
  typename basic_string<charT, traits, Allocator>::size_type pos = 0,
59
  typename basic_string<charT, traits, Allocator>::size_type n
60
  = basic_string<charT, traits, Allocator>::npos,
61
  charT zero = charT('0'),
62
  charT one = charT('1'));
63
+ template<class charT, class traits>
64
+ constexpr explicit bitset(
65
+ basic_string_view<charT, traits> str,
66
+ typename basic_string_view<charT, traits>::size_type pos = 0,
67
+ typename basic_string_view<charT, traits>::size_type n
68
+ = basic_string_view<charT, traits>::npos,
69
+ charT zero = charT('0'),
70
+ charT one = charT('1'));
71
  template<class charT>
72
  constexpr explicit bitset(
73
  const charT* str,
74
+ typename basic_string_view<charT>::size_type n = basic_string_view<charT>::npos,
75
  charT zero = charT('0'),
76
  charT one = charT('1'));
77
 
78
  // [bitset.members], bitset operations
79
  constexpr bitset& operator&=(const bitset& rhs) noexcept;
 
165
  typename basic_string<charT, traits, Allocator>::size_type pos = 0,
166
  typename basic_string<charT, traits, Allocator>::size_type n
167
  = basic_string<charT, traits, Allocator>::npos,
168
  charT zero = charT('0'),
169
  charT one = charT('1'));
170
+ template<class charT, class traits>
171
+ constexpr explicit bitset(
172
+ basic_string_view<charT, traits> str,
173
+ typename basic_string_view<charT, traits>::size_type pos = 0,
174
+ typename basic_string_view<charT, traits>::size_type n
175
+ = basic_string_view<charT, traits>::npos,
176
+ charT zero = charT('0'),
177
+ charT one = charT('1'));
178
  ```
179
 
180
  *Effects:* Determines the effective length `rlen` of the initializing
181
  string as the smaller of `n` and `str.size() - pos`. Initializes the
182
  first `M` bit positions to values determined from the corresponding
 
198
 
199
  ``` cpp
200
  template<class charT>
201
  constexpr explicit bitset(
202
  const charT* str,
203
+ typename basic_string_view<charT>::size_type n = basic_string_view<charT>::npos,
204
  charT zero = charT('0'),
205
  charT one = charT('1'));
206
  ```
207
 
208
  *Effects:* As if by:
209
 
210
  ``` cpp
211
+ bitset(n == basic_string_view<charT>::npos
212
+ ? basic_string_view<charT>(str)
213
+ : basic_string_view<charT>(str, n),
214
  0, n, zero, one)
215
  ```
216
 
217
  #### Members <a id="bitset.members">[[bitset.members]]</a>
218
 
 
350
 
351
  ``` cpp
352
  constexpr bool operator[](size_t pos) const;
353
  ```
354
 
355
+ `pos < size()` is `true`.
356
 
357
  *Returns:* `true` if the bit at position `pos` in `*this` has the value
358
  one, otherwise `false`.
359
 
360
  *Throws:* Nothing.
361
 
362
  ``` cpp
363
  constexpr bitset::reference operator[](size_t pos);
364
  ```
365
 
366
+ `pos < size()` is `true`.
367
 
368
  *Returns:* An object of type `bitset::reference` such that
369
  `(*this)[pos] == this->test(pos)`, and such that `(*this)[pos] = val` is
370
  equivalent to `this->set(pos, val)`.
371