|
| template<class To, class From> |
| std::enable_if_t< sizeof(To)==sizeof(From) &&std::is_trivially_copyable_v< From > &&std::is_trivially_copyable_v< To >, To > | bit_cast (const From &src) noexcept |
| template<typename ToType, typename ReportPolicy = ReportPolicyAssertion, typename FromType> |
| ToType | checkedConversion (FromType from) |
| | Safely convert between two different integral types. If the value stored in from cannot be represented in ToType, the value is truncated.
|
| template<typename ToType, typename ReportPolicy = ReportPolicyIgnore, typename FromType> |
| ToType | ignoredLossyConversion (FromType from) |
| | Safely convert between two different integral types. If the value stored in from cannot be represented in ToType, the value is truncated.
|
| template<class T, class U> |
| constexpr bool | cmp_equal (T t, U u) noexcept |
| template<class T, class U> |
| constexpr bool | cmp_not_equal (T t, U u) noexcept |
| template<class T, class U> |
| constexpr bool | cmp_less (T t, U u) noexcept |
| template<class T, class U> |
| constexpr bool | cmp_greater (T t, U u) noexcept |
| template<class T, class U> |
| constexpr bool | cmp_less_equal (T t, U u) noexcept |
| template<class T, class U> |
| constexpr bool | cmp_greater_equal (T t, U u) noexcept |
| std::string | fromU8string (const std::string &s) |
| std::string | fromU8string (std::string &&s) |
| const char * | castToCharPtr (const char *cp) |
template<typename ToType, typename ReportPolicy = ReportPolicyAssertion, typename FromType>
| ToType sen::std_util::checkedConversion |
( |
FromType | from | ) |
|
|
nodiscard |
Safely convert between two different integral types. If the value stored in from cannot be represented in ToType, the value is truncated.
note: by default, this function asserts when a truncation is necessary
- Template Parameters
-
| ToType | output type |
| ReportPolicy | policy type that specifies how truncation should be reported |
| FromType | input type |
- Parameters
-
| [in] | from | value that should be converted to ToType |
- Returns
- from value represented as ToType, possibly truncated within the range of ToType
template<typename ToType, typename ReportPolicy = ReportPolicyIgnore, typename FromType>
| ToType sen::std_util::ignoredLossyConversion |
( |
FromType | from | ) |
|
|
nodiscard |
Safely convert between two different integral types. If the value stored in from cannot be represented in ToType, the value is truncated.
note: by default, this function ignores truncation errors
- Template Parameters
-
| ToType | output type |
| ReportPolicy | policy type that specifies how truncation should be reported |
| FromType | input type |
- Parameters
-
| [in] | from | value that should be converted to ToType |
- Returns
- from value represented as ToType, possibly truncated within the range of ToType