tmp/tmpx41zc9ib/{from.md → to.md}
RENAMED
|
@@ -1,72 +1,65 @@
|
|
| 1 |
-
####
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
constexpr bitset() noexcept;
|
| 5 |
```
|
| 6 |
|
| 7 |
-
*Effects:*
|
| 8 |
-
bits to zero.
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
constexpr bitset(unsigned long long val) noexcept;
|
| 12 |
```
|
| 13 |
|
| 14 |
-
*Effects:*
|
| 15 |
-
|
| 16 |
-
the
|
| 17 |
-
|
| 18 |
-
the remaining bit positions are initialized to zero.
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
template<class charT, class traits, class Allocator>
|
| 22 |
-
explicit
|
| 23 |
-
|
| 24 |
typename basic_string<charT, traits, Allocator>::size_type pos = 0,
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
| 28 |
```
|
| 29 |
|
| 30 |
-
*Throws:* `out_of_range` if `pos > str.size()` or `invalid_argument` if
|
| 31 |
-
an invalid character is found (see below).
|
| 32 |
-
|
| 33 |
*Effects:* Determines the effective length `rlen` of the initializing
|
| 34 |
-
string as the smaller of `n` and `str.size() - pos`.
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
`invalid_argument` if any of the `rlen` characters in `str` beginning at
|
| 39 |
-
position `pos` is other than `zero` or `one`. The function uses
|
| 40 |
-
`traits::eq()` to compare the character values.
|
| 41 |
-
|
| 42 |
-
Otherwise, the function constructs an object of class `bitset<N>`,
|
| 43 |
-
initializing the first `M` bit positions to values determined from the
|
| 44 |
-
corresponding characters in the string `str`. `M` is the smaller of `N`
|
| 45 |
-
and `rlen`.
|
| 46 |
|
| 47 |
An element of the constructed object has value zero if the corresponding
|
| 48 |
character in `str`, beginning at position `pos`, is `zero`. Otherwise,
|
| 49 |
the element has the value one. Character position `pos + M - 1`
|
| 50 |
corresponds to bit position zero. Subsequent decreasing character
|
| 51 |
positions correspond to increasing bit positions.
|
| 52 |
|
| 53 |
If `M < N`, remaining bit positions are initialized to zero.
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
``` cpp
|
| 56 |
template<class charT>
|
| 57 |
explicit bitset(
|
| 58 |
const charT* str,
|
| 59 |
typename basic_string<charT>::size_type n = basic_string<charT>::npos,
|
| 60 |
-
charT zero = charT('0'),
|
|
|
|
| 61 |
```
|
| 62 |
|
| 63 |
-
*Effects:*
|
| 64 |
|
| 65 |
``` cpp
|
| 66 |
-
bitset(
|
| 67 |
-
n == basic_string<charT>::npos
|
| 68 |
? basic_string<charT>(str)
|
| 69 |
: basic_string<charT>(str, n),
|
| 70 |
0, n, zero, one)
|
| 71 |
```
|
| 72 |
|
|
|
|
| 1 |
+
#### Constructors <a id="bitset.cons">[[bitset.cons]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
constexpr bitset() noexcept;
|
| 5 |
```
|
| 6 |
|
| 7 |
+
*Effects:* Initializes all bits in `*this` to zero.
|
|
|
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
constexpr bitset(unsigned long long val) noexcept;
|
| 11 |
```
|
| 12 |
|
| 13 |
+
*Effects:* Initializes the first `M` bit positions to the corresponding
|
| 14 |
+
bit values in `val`. `M` is the smaller of `N` and the number of bits in
|
| 15 |
+
the value representation [[basic.types]] of `unsigned long long`. If
|
| 16 |
+
`M < N`, the remaining bit positions are initialized to zero.
|
|
|
|
| 17 |
|
| 18 |
``` cpp
|
| 19 |
template<class charT, class traits, class Allocator>
|
| 20 |
+
explicit bitset(
|
| 21 |
+
const basic_string<charT, traits, Allocator>& str,
|
| 22 |
typename basic_string<charT, traits, Allocator>::size_type pos = 0,
|
| 23 |
+
typename basic_string<charT, traits, Allocator>::size_type n
|
| 24 |
+
= basic_string<charT, traits, Allocator>::npos,
|
| 25 |
+
charT zero = charT('0'),
|
| 26 |
+
charT one = charT('1'));
|
| 27 |
```
|
| 28 |
|
|
|
|
|
|
|
|
|
|
| 29 |
*Effects:* Determines the effective length `rlen` of the initializing
|
| 30 |
+
string as the smaller of `n` and `str.size() - pos`. Initializes the
|
| 31 |
+
first `M` bit positions to values determined from the corresponding
|
| 32 |
+
characters in the string `str`. `M` is the smaller of `N` and `rlen`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
An element of the constructed object has value zero if the corresponding
|
| 35 |
character in `str`, beginning at position `pos`, is `zero`. Otherwise,
|
| 36 |
the element has the value one. Character position `pos + M - 1`
|
| 37 |
corresponds to bit position zero. Subsequent decreasing character
|
| 38 |
positions correspond to increasing bit positions.
|
| 39 |
|
| 40 |
If `M < N`, remaining bit positions are initialized to zero.
|
| 41 |
|
| 42 |
+
The function uses `traits::eq` to compare the character values.
|
| 43 |
+
|
| 44 |
+
*Throws:* `out_of_range` if `pos > str.size()` or `invalid_argument` if
|
| 45 |
+
any of the `rlen` characters in `str` beginning at position `pos` is
|
| 46 |
+
other than `zero` or `one`.
|
| 47 |
+
|
| 48 |
``` cpp
|
| 49 |
template<class charT>
|
| 50 |
explicit bitset(
|
| 51 |
const charT* str,
|
| 52 |
typename basic_string<charT>::size_type n = basic_string<charT>::npos,
|
| 53 |
+
charT zero = charT('0'),
|
| 54 |
+
charT one = charT('1'));
|
| 55 |
```
|
| 56 |
|
| 57 |
+
*Effects:* As if by:
|
| 58 |
|
| 59 |
``` cpp
|
| 60 |
+
bitset(n == basic_string<charT>::npos
|
|
|
|
| 61 |
? basic_string<charT>(str)
|
| 62 |
: basic_string<charT>(str, n),
|
| 63 |
0, n, zero, one)
|
| 64 |
```
|
| 65 |
|