Py2Cpp 1.6.3; VERSION ${PROJECT_VERSION}
Loading...
Searching...
No Matches
Classes | Functions
fun Namespace Reference

Classes

struct  Fraction
 Fraction. More...
 

Functions

template<typename T >
CONSTEXPR14 auto abs (const T &a) -> typename std::enable_if< std::is_unsigned< T >::value, T >::type
 Absolute value for unsigned types.
 
template<typename Mn >
CONSTEXPR14 auto gcd_recur (const Mn &_m, const Mn &_n) -> Mn
 Greatest common divisor (recursive)
 
template<typename Mn >
CONSTEXPR14 auto gcd (const Mn &_m, const Mn &_n) -> Mn
 Greatest common divisor.
 
template<typename Mn >
CONSTEXPR14 auto lcm (const Mn &_m, const Mn &_n) -> Mn
 Least common multiple.
 

Function Documentation

◆ abs()

template<typename T >
CONSTEXPR14 auto fun::abs ( const T &  a) -> typename std::enable_if<std::is_unsigned<T>::value, T>::type

Absolute value for unsigned types.

For unsigned types, the absolute value is the number itself.

Template Parameters
TThe numeric type
Parameters
[in]aThe value to compute absolute value of
Returns
T The absolute value

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Absolute value for signed types. For signed types, returns the negative value if the input is negative.

◆ gcd()

template<typename Mn >
CONSTEXPR14 auto fun::gcd ( const Mn &  _m,
const Mn &  _n 
) -> Mn

Greatest common divisor.

Computes the greatest common divisor of two numbers.

Template Parameters
MnThe numeric type
Parameters
[in]_mFirst number
[in]_nSecond number
Returns
Mn The greatest common divisor

◆ gcd_recur()

template<typename Mn >
CONSTEXPR14 auto fun::gcd_recur ( const Mn &  _m,
const Mn &  _n 
) -> Mn

Greatest common divisor (recursive)

Computes the greatest common divisor of two numbers using Euclidean algorithm.

Template Parameters
MnThe numeric type
Parameters
[in]_mFirst number
[in]_nSecond number
Returns
Mn The greatest common divisor

◆ lcm()

template<typename Mn >
CONSTEXPR14 auto fun::lcm ( const Mn &  _m,
const Mn &  _n 
) -> Mn

Least common multiple.

Template Parameters
Mn
Parameters
[in]_m
[in]_n
Returns
Mn