From Jason Turner

[bit.cast]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwpaj7xln/{from.md → to.md} +31 -0
tmp/tmpwpaj7xln/{from.md → to.md} RENAMED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Function template `bit_cast` <a id="bit.cast">[[bit.cast]]</a>
2
+
3
+ ``` cpp
4
+ template<class To, class From>
5
+ constexpr To bit_cast(const From& from) noexcept;
6
+ ```
7
+
8
+ *Constraints:*
9
+
10
+ - `sizeof(To) == sizeof(From)` is `true`;
11
+ - `is_trivially_copyable_v<To>` is `true`; and
12
+ - `is_trivially_copyable_v<From>` is `true`.
13
+
14
+ *Returns:* An object of type `To`. Implicitly creates objects nested
15
+ within the result [[intro.object]]. Each bit of the value representation
16
+ of the result is equal to the corresponding bit in the object
17
+ representation of `from`. Padding bits of the result are unspecified.
18
+ For the result and each object created within it, if there is no value
19
+ of the object’s type corresponding to the value representation produced,
20
+ the behavior is undefined. If there are multiple such values, which
21
+ value is produced is unspecified.
22
+
23
+ *Remarks:* This function is `constexpr` if and only if `To`, `From`, and
24
+ the types of all subobjects of `To` and `From` are types `T` such that:
25
+
26
+ - `is_union_v<T>` is `false`;
27
+ - `is_pointer_v<T>` is `false`;
28
+ - `is_member_pointer_v<T>` is `false`;
29
+ - `is_volatile_v<T>` is `false`; and
30
+ - `T` has no non-static data members of reference type.
31
+