47#ifndef HPCOMBI_POWER_HPP_
48#define HPCOMBI_POWER_HPP_
55template <
typename T>
struct Monoid;
69template <
typename T,
typename M = power_helper::Mono
id<T>>
90template <
unsigned exp,
typename T,
typename M = power_helper::Mono
id<T>>
91const T
pow(
const T x) {
92 return (exp == 0) ? M::one()
98namespace power_helper {
113 static const T
one() {
return 1; }
120 static const T
prod(T a, T b) {
return a * b; }
Definition perm16_impl.hpp:236
const T square(const T x)
A generic compile time squaring function.
Definition power.hpp:70
const T pow(const T x)
A generic compile time exponentiation function.
Definition power.hpp:91
Algebraic monoid structure used by default for type T by the pow function and prod function.
Definition power.hpp:111
static const T prod(T a, T b)
the product of two elements of type T
Definition power.hpp:120
static const T one()
The one of type T.
Definition power.hpp:113