Agora  1.2.0
Agora project
fmt::v8::safe_duration_cast Namespace Reference

Functions

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

Function Documentation

◆ lossless_integral_conversion()

template<typename To , typename From , enable_if_t<(!std::is_same< From, To >::value &&std::numeric_limits< From >::is_signed==std::numeric_limits< To >::is_signed), int > = 0>
To fmt::v8::safe_duration_cast::lossless_integral_conversion ( const From  from,
int &  ec 
)

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

Here is the call graph for this function:

◆ safe_duration_cast()

template<typename To , typename FromRep , typename FromPeriod , enable_if_t<(std::is_integral< FromRep >::value), int > = 0, enable_if_t<(std::is_integral< typename To::rep >::value), int > = 0>
To fmt::v8::safe_duration_cast::safe_duration_cast ( std::chrono::duration< FromRep, FromPeriod >  from,
int &  ec 
)

safe duration cast between integral durations

safe duration_cast between floating point durations

Here is the call graph for this function:

◆ safe_float_conversion()

template<typename To , typename From , enable_if_t<(!std::is_same< From, To >::value), int > = 0>
To fmt::v8::safe_duration_cast::safe_float_conversion ( const From  from,
int &  ec 
)

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
Here is the call graph for this function: