blaze::IsPowerOf< B, N > Struct Template Reference

Compile time check for a power relationship of integral values to a given base.This value trait tests whether the given integral value N is a power of the base B according to the equation $ B^x = N $, where x is any positive integer in the range $ [0..\infty) $. In case the value is a power of B, the value member enumeration is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType. More...

#include <IsPowerOf.h>

Inherits blaze::IntegralConstant< T, N >.

Detailed Description

template<size_t B, size_t N>
struct blaze::IsPowerOf< B, N >

Compile time check for a power relationship of integral values to a given base.

This value trait tests whether the given integral value N is a power of the base B according to the equation $ B^x = N $, where x is any positive integer in the range $ [0..\infty) $. In case the value is a power of B, the value member enumeration is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.

blaze::IsPowerOf<2,8>::value // Evaluates to 1 (2^3 = 8)
blaze::IsPowerOf<3,27>::value // Evaluates to 1 (3^3 = 27)
blaze::IsPowerOf<5,1>::value // Evaluates to 1 (5^0 = 1)
blaze::IsPowerOf<1,1>::Type // Results in TrueType (1^x = 1)
blaze::IsPowerOf<0,0> // Is derived from TrueType (0^x = 0)
blaze::IsPowerOf<0,5>::Type // Results in FalseType
blaze::IsPowerOf<2,0> // Is derived from FalseType

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