From Jason Turner

[numeric.sat.cast]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpp8o6wldb/{from.md → to.md} +14 -0
tmp/tmpp8o6wldb/{from.md → to.md} RENAMED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Casting <a id="numeric.sat.cast">[[numeric.sat.cast]]</a>
2
+
3
+ ``` cpp
4
+ template<class R, class T>
5
+ constexpr R saturate_cast(T x) noexcept;
6
+ ```
7
+
8
+ *Constraints:* `R` and `T` are signed or unsigned integer
9
+ types [[basic.fundamental]].
10
+
11
+ *Returns:* If `x` is representable as a value of type `R`, `x`;
12
+ otherwise, either the largest or smallest representable value of type
13
+ `R`, whichever is closer to the value of `x`.
14
+