Power

#include <m3ta/power>

Functions

m3ta::power
template<typename T_Base, typename T_Exponent>
constexpr MultiplicationResultT<T_Base, T_Base>
power(T_Base base, T_Exponent exponent) noexcept
Template Parameters:
 
  • T_Base (automatically deduced) — Type of the base value.
  • T_Exponent (automatically deduced) — Type of the exponent value.
Function Parameters:
 
  • base – Base value.
  • exponent – Exponent value.

Returns

The number base raised to the power exponent.

Traits

m3ta::Power
template<typename T, T T_base, T T_exponent>
struct Power
Template Parameters:
 
  • T – Type of the values.
  • T_base – Base value.
  • T_exponent – Exponent value.

Member Types

type

The type std::integral_constant<T, value> where value is the result of the function m3ta::power().

value_type

The type T.

Member Constants

static constexpr T value

The number T_base raised to the power T_exponent.

Aliases

m3ta::PowerT
template<typename T, T T_base, T T_exponent>
using PowerT = typename Power<T, T_base, T_exponent>::type;

Usage Examples

auto value1 = m3ta::power(4, 3); // 64
auto value2 = m3ta::power(1.0f, -1); // 0.5
auto value3 = m3ta::power(std::complex<float>(1, 1), 2); // std::complex<float>(0, 2)

using Type = m3ta::PowerT<int, 4, 3>; // std::integral_constant<int, 64>