4#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_KIND_WITH_EXPONENT_HPP_
5#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_KIND_WITH_EXPONENT_HPP_
7#include "arene/base/constraints/constraints.hpp"
8#include "arene/base/stdlib_choice/enable_if.hpp"
9#include "arene/base/stdlib_choice/remove_cv.hpp"
10#include "arene/base/units/has_explicit_units.hpp"
11#include "arene/base/units/has_parent_kind.hpp"
12#include "arene/base/units/is_unit.hpp"
13#include "arene/base/units/kind_with_exponent_fwd.hpp"
14#include "arene/base/units/quantity_kind.hpp"
15#include "arene/base/units/quantity_unit.hpp"
16#include "arene/base/units/selected_unit_for.hpp"
21namespace units_detail {
32 exponent_t PositiveExponent,
33 exponent_t NegativeExponent,
35class kind_with_exponent_helper {
36 static_assert(PositiveExponent >= 0,
"The exponents must be non-negative");
37 static_assert(NegativeExponent >= 0,
"The exponents must be non-negative");
41 using type = quantity_kind_with_exponent<Kind, PositiveExponent, NegativeExponent>;
48template <
typename Kind>
49class kind_with_exponent_helper<Kind, 1, 0> {
64template <
typename Kind, exponent_t PositiveExponent, exponent_t NegativeExponent>
65class quantity_kind_with_exponent<
69 constraints<std::enable_if_t<!has_parent_kind_v<Kind>>, std::enable_if_t<!has_explicit_units_v<Kind>>>>
70 :
public quantity_kind<quantity_kind_with_exponent<Kind, PositiveExponent, NegativeExponent>> {
74 using is_implicit =
void;
86template <
typename Kind, exponent_t PositiveExponent, exponent_t NegativeExponent>
87class quantity_kind_with_exponent<
91 constraints<std::enable_if_t<is_unit_v<Kind>>>>
92 :
public quantity_unit<
93 quantity_kind_with_exponent<Kind, PositiveExponent, NegativeExponent>,
94 typename kind_with_exponent_helper<
95 typename Kind::parent_quantity_kind_type,
97 NegativeExponent>::type> {
101 using is_implicit =
void;
113template <
typename Kind, exponent_t PositiveExponent, exponent_t NegativeExponent>
114class quantity_kind_with_exponent<
119 std::enable_if_t<!is_unit_v<Kind>>,
120 std::enable_if_t<has_parent_kind_v<Kind>>,
121 std::enable_if_t<!has_explicit_units_v<Kind>>>>
122 :
public quantity_kind<
123 quantity_kind_with_exponent<Kind, PositiveExponent, NegativeExponent>,
124 typename kind_with_exponent_helper<
125 typename Kind::parent_quantity_kind_type,
127 NegativeExponent>::type> {
131 using is_implicit =
void;
143template <
typename Kind, exponent_t PositiveExponent, exponent_t NegativeExponent>
144class quantity_kind_with_exponent<
148 constraints<std::enable_if_t<!has_parent_kind_v<Kind>>, std::enable_if_t<has_explicit_units_v<Kind>>>>
149 :
public quantity_kind<
150 quantity_kind_with_exponent<Kind, PositiveExponent, NegativeExponent>,
151 typename kind_with_exponent_helper<selected_unit_for_t<Kind>, PositiveExponent, NegativeExponent>::type> {
155 using is_implicit =
void;
167template <
typename Kind, exponent_t PositiveExponent, exponent_t NegativeExponent>
168class quantity_kind_with_exponent<
172 constraints<std::enable_if_t<has_parent_kind_v<Kind>>, std::enable_if_t<has_explicit_units_v<Kind>>>>
173 :
public quantity_kind<
174 quantity_kind_with_exponent<Kind, PositiveExponent, NegativeExponent>,
175 typename kind_with_exponent_helper<
176 typename Kind::parent_quantity_kind_type,
178 NegativeExponent>::type,
179 typename kind_with_exponent_helper<selected_unit_for_t<Kind>, PositiveExponent, NegativeExponent>::type> {
183 using is_implicit =
void;
196 exponent_t BasePositiveExponent,
197 exponent_t BaseNegativeExponent,
198 exponent_t PositiveExponent,
199 exponent_t NegativeExponent>
200class kind_with_exponent_helper<
201 quantity_kind_with_exponent<BaseKind, BasePositiveExponent, BaseNegativeExponent>,
207 std::enable_if_t<!(PositiveExponent == 1 && NegativeExponent == 0)>>> {
211 using type =
typename kind_with_exponent_helper<
213 BasePositiveExponent * PositiveExponent + BaseNegativeExponent * NegativeExponent,
214 BasePositiveExponent * NegativeExponent + BaseNegativeExponent * PositiveExponent>::type;
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10