4#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_QUANTITY_ORIGIN_HPP_
5#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_QUANTITY_ORIGIN_HPP_
7#include "arene/base/constraints/constraints.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 {
51constexpr auto is_origin_impl(
void*)
noexcept -> std::false_type {
60template <
typename Origin>
61extern constexpr bool is_origin_v =
decltype(is_origin_impl<Origin>(std::declval<Origin*>())){};
65template <
typename Kind,
typename = constraints<>>
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 = constraints<>>
77extern constexpr bool origin_is_relative_to_v = std::is_same<ParentOrigin, DerivedOrigin>::value;
82template <
typename DerivedOrigin,
typename ParentOrigin>
84 origin_is_relative_to_v<DerivedOrigin, ParentOrigin, constraints<
typename DerivedOrigin::base_origin>> =
85 std::is_same<
typename DerivedOrigin::base_origin,
typename ParentOrigin::origin>::value;
91template <
typename Derived>
92class quantity_origin {
95 using origin = Derived;
101template <
typename Derived,
typename BaseOrigin>
102class relative_origin {
104 quantity_origin_detail::is_origin_v<BaseOrigin>,
105 "The base origin supplied to relative_origin must actually be a quantity origin"
110 using base_origin = BaseOrigin;
112 using origin = Derived;
117template <
typename Kind>
122template <
typename Kind>
127template <
typename Kind>
128using quantity_origin_t =
typename Kind::origin;
Definition array_exceptions_disabled.cpp:11
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,...
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10