Functions
safe_duration_cast Namespace Reference

Functions

template<typename To , typename From , FMT_ENABLE_IF(!std::is_same< From, To >::value && std::numeric_limits< From >::is_signed== std::numeric_limits< To >::is_signed) >
FMT_CONSTEXPR auto lossless_integral_conversion (const From from, int &ec) -> To
 
template<typename To , typename FromRep , typename FromPeriod , FMT_ENABLE_IF(std::is_integral< FromRep >::value) , FMT_ENABLE_IF(std::is_integral< typename To::rep >::value) >
auto safe_duration_cast (std::chrono::duration< FromRep, FromPeriod > from, int &ec) -> To
 
template<typename To , typename From , FMT_ENABLE_IF(!std::is_same< From, To >::value) >
FMT_CONSTEXPR auto safe_float_conversion (const From from, int &ec) -> To
 

Function Documentation

◆ lossless_integral_conversion()

template<typename To , typename From , FMT_ENABLE_IF(!std::is_same< From, To >::value && std::numeric_limits< From >::is_signed== std::numeric_limits< To >::is_signed) >
FMT_CONSTEXPR auto safe_duration_cast::lossless_integral_conversion ( const From  from,
int &  ec 
) -> To

converts From to To, without loss. If the dynamic value of from can't be converted to To without loss, ec is set.

Definition at line 75 of file chrono.h.

◆ safe_duration_cast()

template<typename To , typename FromRep , typename FromPeriod , FMT_ENABLE_IF(std::is_integral< FromRep >::value) , FMT_ENABLE_IF(std::is_integral< typename To::rep >::value) >
auto safe_duration_cast::safe_duration_cast ( std::chrono::duration< FromRep, FromPeriod >  from,
int &  ec 
) -> To

safe duration cast between integral durations

safe duration_cast between floating point durations

Definition at line 194 of file chrono.h.

◆ safe_float_conversion()

template<typename To , typename From , FMT_ENABLE_IF(!std::is_same< From, To >::value) >
FMT_CONSTEXPR auto safe_duration_cast::safe_float_conversion ( const From  from,
int &  ec 
) -> To

converts From to To if possible, otherwise ec is set.

input output
NaN NaN
Inf Inf
normal, fits in output converted (possibly lossy)
normal, does not fit in output ec is set
subnormal best effort
-Inf -Inf

Definition at line 160 of file chrono.h.



plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:52