TypeTraits(3)
| TypeTraits(3) | Unit Conversion and Dimensional Analysis Library | TypeTraits(3) |
NAME
TypeTraits - Type Traits
- Defines a series of classes to obtain unit type information at
compile-time.
SYNOPSIS
Namespaces
namespace units::traits
namespace representing type traits which can access the properties of types
provided by the units library.
Classes
struct units::traits::is_base_unit< T >
Trait which tests if a class is a base_unit type. struct
units::traits::is_unit< T >
Traits which tests if a class is a unit struct
units::traits::is_convertible_unit< U1, U2 >
Trait which checks whether two units can be converted to each other. struct
units::traits::is_nonlinear_scale< T, Ret >
Trait which tests that class T meets the requirements for a non-linear
scale. struct units::traits::is_convertible_unit_t< U1, U2
>
Trait which tests whether two container types derived from unit_t
are convertible to each other. struct units::traits::is_unit_t< T
>
Traits which tests if a class is a unit struct
units::traits::has_linear_scale< T >
Trait which tests whether a type is inherited from a linear scale. struct
units::traits::has_decibel_scale< T >
Trait which tests whether a type is inherited from a decibel scale. struct
units::traits::is_same_scale< T1, T2 >
Trait which tests whether two types has the same non-linear scale. struct
units::traits::is_unit_value_t< T, Units >
Trait which tests whether a type is a unit_value_t representing the
given unit type. struct units::traits::is_unit_value_t_category<
Category, T >
Trait which tests whether type T is a unit_value_t with a unit type in
the given category.
Typedefs
template<typename Ratio , std::intmax_t Eps = 10000000000>
using units::ratio_sqrt = typename units::detail::Sqrt< Ratio,
std::ratio< 1, Eps > >::type
Calculate square root of a ratio at compile-time.
Detailed Description
Defines a series of classes to obtain unit type information at compile-time.
Typedef Documentation
template<typename Ratio , std::intmax_t Eps = 10000000000> using units::ratio_sqrt = typedef typename units::detail::Sqrt<Ratio, std::ratio<1, Eps> >::type
Calculate square root of a ratio at compile-time. Calculates a rational approximation of the square root of the ratio. The error in the calculation is bounded by 1/epsilon (Eps). E.g. for the default value of 10000000000, the maximum error will be a/10000000000, or 1e-8, or said another way, the error will be on the order of 10^-9. Since these calculations are done at compile time, it is advisable to set epsilon to the highest value that does not cause an integer overflow in the calculation. If you can't compile ratio_sqrt due to overflow errors, reducing the value of epsilon sufficiently will correct the problem.
ratio_sqrt is guaranteed to converge for all values of Ratio which do
not overflow.
Note
Template Parameters
Eps Value of epsilon, which represents the inverse of the maximum allowable error. This value should be chosen to be as high as possible before integer overflow errors occur in the compiler.
Author
Generated automatically by Doxygen for Unit Conversion and Dimensional Analysis Library from the source code.
| Wed Mar 29 2023 | Version 2.3.0 |
