WPILibC++ 2024.3.2
units::traits Namespace Reference

namespace representing type traits which can access the properties of types provided by the units library. More...

Classes

struct  has_decibel_scale
 Trait which tests whether a type is inherited from a decibel scale. More...
 
struct  has_linear_scale
 Trait which tests whether a type is inherited from a linear scale. More...
 
struct  is_base_unit
 Trait which tests if a class is a base_unit type. More...
 
struct  is_convertible_unit
 Trait which checks whether two units can be converted to each other. More...
 
struct  is_convertible_unit_t
 Trait which tests whether two container types derived from unit_t are convertible to each other. More...
 
struct  is_dimensionless_unit
 
struct  is_nonlinear_scale
 Trait which tests that class T meets the requirements for a non-linear scale. More...
 
struct  is_ratio
 Trait that tests whether a type represents a std::ratio. More...
 
struct  is_same_scale
 Trait which tests whether two types has the same non-linear scale. More...
 
struct  is_unit
 Traits which tests if a class is a unit More...
 
struct  is_unit_t
 Traits which tests if a class is a unit More...
 
struct  is_unit_value_t
 Trait which tests whether a type is a unit_value_t representing the given unit type. More...
 
struct  is_unit_value_t_category
 Trait which tests whether type T is a unit_value_t with a unit type in the given category. More...
 

Typedefs

template<class U >
using base_unit_of = typename units::detail::base_unit_of_impl< U >::type
 Trait which returns the base_unit type that a unit is originally derived from. More...
 

Variables

template<class T >
constexpr bool is_ratio_v = is_ratio<T>::value
 
template<class T >
constexpr bool is_unit_v = is_unit<T>::value
 
template<class U1 , class U2 >
constexpr bool is_convertible_unit_v = is_convertible_unit<U1, U2>::value
 
template<class T >
constexpr bool is_unit_t_v = is_unit_t<T>::value
 
template<typename... T>
constexpr bool has_linear_scale_v = has_linear_scale<T...>::value
 
template<typename... T>
constexpr bool has_decibel_scale_v = has_decibel_scale<T...>::value
 
template<typename T1 , typename T2 >
constexpr bool is_same_scale_v = is_same_scale<T1, T2>::value
 
template<typename T , typename Units = typename traits::unit_value_t_traits<T>::unit_type>
constexpr bool is_unit_value_t_v = is_unit_value_t<T, Units>::value
 
template<typename Category , typename T >
constexpr bool is_unit_value_t_category_v = is_unit_value_t_category<Category, T>::value
 

Detailed Description

namespace representing type traits which can access the properties of types provided by the units library.

Typedef Documentation

◆ base_unit_of

template<class U >
using units::traits::base_unit_of = typedef typename units::detail::base_unit_of_impl<U>::type

Trait which returns the base_unit type that a unit is originally derived from.

Since units can be derived from other unit types in addition to base_unit types, the base_unit_type typedef will not always be a base_unit (or unit category). Since compatible

Variable Documentation

◆ has_decibel_scale_v

template<typename... T>
constexpr bool units::traits::has_decibel_scale_v = has_decibel_scale<T...>::value
inlineconstexpr

◆ has_linear_scale_v

template<typename... T>
constexpr bool units::traits::has_linear_scale_v = has_linear_scale<T...>::value
inlineconstexpr

◆ is_convertible_unit_v

template<class U1 , class U2 >
constexpr bool units::traits::is_convertible_unit_v = is_convertible_unit<U1, U2>::value
inlineconstexpr

◆ is_ratio_v

template<class T >
constexpr bool units::traits::is_ratio_v = is_ratio<T>::value
inlineconstexpr

◆ is_same_scale_v

template<typename T1 , typename T2 >
constexpr bool units::traits::is_same_scale_v = is_same_scale<T1, T2>::value
inlineconstexpr

◆ is_unit_t_v

template<class T >
constexpr bool units::traits::is_unit_t_v = is_unit_t<T>::value
inlineconstexpr

◆ is_unit_v

template<class T >
constexpr bool units::traits::is_unit_v = is_unit<T>::value
inlineconstexpr

◆ is_unit_value_t_category_v

template<typename Category , typename T >
constexpr bool units::traits::is_unit_value_t_category_v = is_unit_value_t_category<Category, T>::value
inlineconstexpr

◆ is_unit_value_t_v

template<typename T , typename Units = typename traits::unit_value_t_traits<T>::unit_type>
constexpr bool units::traits::is_unit_value_t_v = is_unit_value_t<T, Units>::value
inlineconstexpr