arg_router  1.4.0
C++ command line argument parsing and routing
arg_router::math Namespace Reference

Functions

template<typename T >
constexpr T abs (T value) noexcept
 
template<typename T >
constexpr T num_digits (T value) noexcept
 
template<auto Base, typename T >
constexpr T pow (T exp) noexcept
 

Detailed Description

Mathematical functions and types.

Function Documentation

◆ abs()

template<typename T >
constexpr T arg_router::math::abs ( value)
constexprnoexcept

Returns the absolute value of the integer value.

This only exists because std::abs(T) is not constexpr.

Template Parameters
TIntegral type
Parameters
valueInput
Returns
Absolute value

Definition at line 20 of file math.hpp.

◆ num_digits()

template<typename T >
constexpr T arg_router::math::num_digits ( value)
constexprnoexcept

Returns the number of digits in value.

Basicaly log10(value)+1 but constexpr.

Template Parameters
TIntegral type
Parameters
valueInput
Returns
Number of digits.

Definition at line 38 of file math.hpp.

◆ pow()

template<auto Base, typename T >
constexpr T arg_router::math::pow ( exp)
constexprnoexcept

Power function.

This only exists because std::power(T) is not constexpr.

Template Parameters
BasePower base
TIntegral type
Parameters
expExponent
Returns
Base raised to the power exp

Definition at line 62 of file math.hpp.