4#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_UNITS_CONVERSION_TRAITS_HPP_
5#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_UNITS_CONVERSION_TRAITS_HPP_
8#include "arene/base/stdlib_choice/enable_if.hpp"
9#include "arene/base/stdlib_choice/is_same.hpp"
10#include "arene/base/stdlib_choice/ratio.hpp"
22namespace units_conversion_traits_detail {
26template <
typename Kind,
typename = constra
ints<>>
27extern constexpr bool is_explicit_with_implicit_parent_v =
false;
31template <
typename Kind>
32extern constexpr bool is_explicit_with_implicit_parent_v<
40template <
typename Type,
typename = constra
ints<>>
41extern constexpr bool has_scale_factor_v =
false;
45template <
typename Type>
46extern constexpr bool has_scale_factor_v<Type, constraints<typename Type::scale_factor>> =
true;
53template <
typename From,
typename To,
typename = constra
ints<>>
54class units_conversion_traits_impl {
60 static constexpr bool compatible{
false};
68template <
typename From>
74 static constexpr bool compatible{
true};
78 using scale_factor = std::ratio<1, 1>;
83template <
typename Kind,
typename = constra
ints<>>
84struct destination_base_set {
90 static constexpr auto value = units_detail::explicit_base_set<Kind>;
98template <
typename Kind>
99struct destination_base_set<Kind,
constraints<std::
enable_if_t<is_explicit_with_implicit_parent_v<Kind>>>> {
105 static constexpr auto value = units_detail::explicit_base_set<typename Kind::parent_quantity_kind_type>;
120template <
typename From,
typename To>
121class units_conversion_traits_impl<
136 static constexpr auto value = units_detail::explicit_base_set<From>;
143 using lifted_source_set =
146 using lifted_dest_set = type_lists::
147 apply_all_t<units_detail::as_list_of_kinds_with_exponents_t<destination_base_set<To>>,
combine_kinds_t>;
161 static constexpr bool
167 using scale_factor = std::ratio<1, 1>;
180template <
typename From,
typename To>
Traits class with information about if and how a physical unit of type From can be converted to a phy...
Definition units_conversion_traits.hpp:181
static constexpr value_type value
Definition integral_constant.hpp:34
typename apply_all< L0, Func >::type apply_all_t
Evaluate a template meta-function, passing the elements of the type-list L0 as the arguments.
Definition apply_all.hpp:55
Definition accumulate.hpp:37
constexpr bool is_base_quantity_kind_of_v
Type trait for checking if one type is a base quantity kind for another. Evaluates to true if the fir...
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
typename combine_kinds_detail::canonicalize_post_combining< typename combine_kinds_detail::internal_combine_kinds< combine_kinds_detail::normalize_for_combining_t< Kinds >... >::type >::type combine_kinds_t
Template alias to combine a list of quantity kinds.
Definition combine_kinds.hpp:274
Definition accumulate.hpp:36
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41