This is an example of how to use pow with a non numerical Monoid.
This is an example of how to use pow with a non numerical Monoid.
#include <cassert>
#include <string>
namespace power_helper {
template <>
struct Monoid<
std::string> {
static std::string
one() {
return {}; };
static std::string
prod(std::string a, std::string b) {
return a + b; }
};
}
}
}
int main()
Definition CF.cpp:75
const T pow(const T x)
A generic compile time exponentiation function.
Definition power.hpp:83
Generic compile time power.
static const T prod(T a, T b)
the product of two elements of type T
Definition power.hpp:112
static const T one()
The one of type T.
Definition power.hpp:105