4#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_QUANTITY_ORIGIN_HPP_
5#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_QUANTITY_ORIGIN_HPP_
8#include "arene/base/stdlib_choice/declval.hpp"
9#include "arene/base/stdlib_choice/integral_constant.hpp"
10#include "arene/base/stdlib_choice/is_same.hpp"
17template <
typename Derived>
23template <
typename Derived,
typename BaseOrigin>
26namespace quantity_origin_detail {
34template <
typename Origin>
35constexpr auto is_origin_impl(quantity_origin<Origin>*)
noexcept ->
std::true_type {
43template <
typename Origin,
typename OtherOrigin>
44constexpr auto is_origin_impl(relative_origin<Origin, OtherOrigin>*)
noexcept ->
std::true_type {
60template <
typename Origin>
65template <
typename Kind,
typename = constra
ints<>>
66extern constexpr bool has_origin_v =
false;
70template <
typename Kind>
71extern constexpr bool has_origin_v<Kind, constraints<typename Kind::origin>> = is_origin_v<typename Kind::origin>;
76template <
typename DerivedOrigin,
typename ParentOrigin,
typename = constra
ints<>>
82template <
typename DerivedOrigin,
typename ParentOrigin>
84 origin_is_relative_to_v<DerivedOrigin, ParentOrigin, constraints<typename DerivedOrigin::base_origin>> =
91template <
typename Derived>
101template <
typename Derived,
typename BaseOrigin>
104 quantity_origin_detail::is_origin_v<BaseOrigin>,
105 "The base origin supplied to relative_origin must actually be a quantity origin"
117template <
typename Kind>
122template <
typename Kind>
127template <
typename Kind>
CRTP base class used when defining a new quantity origin, e.g. absolute zero for temperature.
Definition quantity_origin.hpp:92
Derived origin
Type alias used to identify downstream classes as being anchored to this origin.
Definition quantity_origin.hpp:95
CRTP base class used when defining a new relative origin, e.g. zero celsius which is relative to zero...
Definition quantity_origin.hpp:102
Derived origin
Type alias used to identify downstream classes as being anchored to this origin.
Definition quantity_origin.hpp:112
BaseOrigin base_origin
Type alias for the base origin to allow checking that the two origins are related.
Definition quantity_origin.hpp:110
static constexpr value_type value
Definition integral_constant.hpp:34
Definition accumulate.hpp:37
typename Kind::origin quantity_origin_t
Type trait to get the origin of a quantity; if none exists, then this will cause a compilation error.
Definition quantity_origin.hpp:128
constexpr bool quantity_has_origin_v
Type trait to check if a quantity kind has an origin. The value is true if it does,...
constexpr bool is_quantity_origin_v
Type trait to check if a quantity kind is itself an origin. The value is true if it is,...
Definition accumulate.hpp:36
bool_constant< false > false_type
An alias for bool_constant<false>
Definition integral_constant.hpp:79
bool_constant< true > true_type
An alias for bool_constant<true>
Definition integral_constant.hpp:76
auto declval() noexcept -> T &&
A dummy function that is declared but not defined, with a user-specified return type,...