Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
kind_with_exponent_fwd.hpp
Go to the documentation of this file.
1// Copyright 2026, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_KIND_WITH_EXPONENT_FWD_HPP_
5#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_KIND_WITH_EXPONENT_FWD_HPP_
6
7#include "arene/base/constraints/constraints.hpp"
8#include "arene/base/stdlib_choice/cstdint.hpp"
9#include "arene/base/stdlib_choice/remove_cv.hpp"
10
11namespace arene {
12namespace base {
13
14namespace units_detail {
15
16/// @brief The integer type to use for the representation of exponents
17using exponent_t = std::int64_t;
18
19// IWYU pragma: begin_keep
20/// @brief Helper class to determine the result of raising the specified quantity kind to the specified positive and
21/// negative exponents. Both @c PositiveExponent and @c NegativeExponent must be positive. The effective exponent is @c
22/// PositiveExponent - @c NegativeExponent however they are stored separately to allow distinguishing @c m/m from @c s/s
23/// or @c m^2/m^2
24/// @tparam Kind The quantity kind to raise to an exponent
25/// @tparam PositiveExponent The positive exponent to raise it to
26/// @tparam NegativeExponent The negative exponent to raise it to
27template <typename Kind, exponent_t PositiveExponent, exponent_t NegativeExponent, typename = constraints<>>
28class kind_with_exponent_helper;
29
30/// @brief Implementation class for a quantity kind raised to the specified positive and
31/// negative exponents. Both @c PositiveExponent and @c NegativeExponent must be positive. The effective exponent is @c
32/// PositiveExponent - @c NegativeExponent however they are stored separately to allow distinguishing @c m/m from @c s/s
33/// or @c m^2/m^2
34/// @tparam Kind The quantity kind to raise to an exponent
35/// @tparam PositiveExponent The positive exponent to raise it to
36/// @tparam NegativeExponent The negative exponent to raise it to
37template <typename Kind, exponent_t PositiveExponent, exponent_t NegativeExponent, typename = constraints<>>
38class quantity_kind_with_exponent;
39// IWYU pragma: end_keep
40
41} // namespace units_detail
42
43/// @brief Alias template for raising the specified quantity kind to the specified exponent
44/// @tparam Kind The quantity kind to raise to an exponent
45/// @tparam Exponent The exponent to raise it to
46template <typename Kind, units_detail::exponent_t Exponent>
49 (Exponent < 0) ? 0 : Exponent,
50 (Exponent < 0) ? -Exponent : 0>::type;
51
52} // namespace base
53} // namespace arene
54
55#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_KIND_WITH_EXPONENT_FWD_HPP_
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10