libjmmcg  build_2783
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::binary_right_to_left::mpl::pow< V, P > Struct Template Reference

The class to compute the result of raising a value V to an integer power P, at compile-time. More...

#include <integer_power.hpp>

Inherits binary_function< long, long, long >.

Static Public Attributes

static constexpr long power =P
 The power to which the value should be raised. More...
 
static constexpr long value =V
 The value to exponentiate. Negative powers are computed as 1/V^|P|. More...
 
static constexpr long result =(sign<power>::result ? int_result : 1/int_result)
 

Detailed Description

template<long V, long P>
struct jmmcg::binary_right_to_left::mpl::pow< V, P >

The class to compute the result of raising a value V to an integer power P, at compile-time.

The runtime algorithmic-complexity of this function is O(1). The compile-time algorithmic complexity of this function is O(lg(power)+v(power)), where v(power) is the number of 1s in the binary representation of power.

Definition at line 202 of file integer_power.hpp.

Member Data Documentation

◆ power

template<long V, long P>
constexpr long jmmcg::binary_right_to_left::mpl::pow< V, P >::power =P
staticconstexpr

The power to which the value should be raised.

Definition at line 231 of file integer_power.hpp.

◆ result

template<long V, long P>
constexpr long jmmcg::binary_right_to_left::mpl::pow< V, P >::result =(sign<power>::result ? int_result : 1/int_result)
staticconstexpr

Definition at line 239 of file integer_power.hpp.

◆ value

template<long V, long P>
constexpr long jmmcg::binary_right_to_left::mpl::pow< V, P >::value =V
staticconstexpr

The value to exponentiate. Negative powers are computed as 1/V^|P|.

Definition at line 232 of file integer_power.hpp.


The documentation for this struct was generated from the following file: