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_
8#include "arene/base/stdlib_choice/enable_if.hpp"
9#include "arene/base/stdlib_choice/remove_cv.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<
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<
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<
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<
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<
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 accumulate.hpp:37
typename quantity_kind_detail::choose_quantity_kind_base< Derived, std::remove_cv_t< ParentKindOrOriginOrUnit >, std::remove_cv_t< OriginOrUnit >, std::remove_cv_t< Unit > >::type quantity_kind
ParentKind class for declaring a quantity kind with a parent quantity kind.
Definition quantity_kind.hpp:327
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
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