Skip to content

Commit 6ff19ab

Browse files
Tyler WhitneyTyler Whitney
authored andcommitted
draft
1 parent 4fa27bd commit 6ff19ab

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

docs/standard-library/bit-functions.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,29 @@ The \<bit> header includes the following non-member functions:
2323
|[countr_one](#countl_one) | Counts the number of consecutive 1 bits, starting from the least significant bit |
2424
|[popcount](#popcount) | Counts the number of 1 bits in an unsigned integer |
2525

26-
## <a name="as_bytes"></a>`as_bytes`
26+
## <a name="bit_cast"></a>`bit_cast`
2727

28-
Get a read-only view of the object representation of the elements in the span.
28+
Reinterpret `From`.
2929

3030
```cpp
31-
template <class T, size_t Extent>
32-
auto as_bytes(span<T, Extent> s) noexcept;
31+
template <class To, class From>
32+
To bit_cast(const From& from) noexcept;
3333
```
3434
3535
### Parameters
3636
37-
*T*\
38-
The type of the elements in the span.
37+
*To*\
38+
The type of the output.
3939
40-
*Extent*\
41-
The number of elements in the span (if known at compile time), otherwise `dynamic_extent` indicating that the number of elements isn't known until runtime.
40+
*From*\
41+
The type of the value to convert.
4242
43-
*s*\
44-
The span to get the raw representation of.
43+
*from*\
44+
The value to convert.
4545
4646
### Return Value
4747
48-
A `span<const byte, S>` to the first item stored in the span where `S` is `{reinterpret_cast<const std::byte*>(s.data()), s.size_bytes()}`
48+
An object of type `To`. Each bit in the result matches the corresponding bit in `from`, unless there are padding bits in `To`, in which case those bits in the result are unspecified.
4949
5050
### Example
5151
@@ -63,6 +63,8 @@ void main()
6363
}
6464
```
6565

66+
## Remarks
67+
6668
## Requirements
6769

6870
**Header:** \<bit>

0 commit comments

Comments
 (0)