Function abs

Summary

#include <include/type_safe/integer.hpp>

(1) template <typename SignedInteger, typename = typename std::enable_if<std::is_signed<SignedInteger>::value>::type>
    constexpr TYPE_SAFE_FORCE_INLINE make_unsigned_t< SignedInteger > abs(const SignedInteger &i)

(2) template <typename SignedInteger, class Policy, typename = typename std::enable_if<std::is_signed<SignedInteger>::value>::type>
    constexpr TYPE_SAFE_FORCE_INLINE make_unsigned_t< integer< SignedInteger, Policy > > abs(const integer< SignedInteger, Policy > &i)

(3) template <typename UnsignedInteger, typename = typename std::enable_if<std::is_unsigned<UnsignedInteger>::value>::type>
    constexpr TYPE_SAFE_FORCE_INLINE UnsignedInteger abs(const UnsignedInteger &i)

(4) template <typename UnsignedInteger, class Policy, typename = typename std::enable_if<std::is_unsigned<UnsignedInteger>::value>::type>
    constexpr TYPE_SAFE_FORCE_INLINE integer< UnsignedInteger, Policy > abs(const integer< UnsignedInteger, Policy > &i)

Function overload

Synopsis

#include <include/type_safe/integer.hpp>

template <typename SignedInteger, typename = typename std::enable_if<std::is_signed<SignedInteger>::value>::type>
constexpr TYPE_SAFE_FORCE_INLINE make_unsigned_t< SignedInteger > abs(const SignedInteger &i)

Description

Returns
The absolute value of a built-in signed integer. It will be changed to the unsigned return type as well. \module types
Parameters

1 - \exclude

Mentioned in

Source

Lines 413-416 in include/type_safe/integer.hpp.

template <typename SignedInteger,
          typename = typename std::enable_if<std::is_signed<SignedInteger>::value>::type>
TYPE_SAFE_FORCE_INLINE constexpr make_unsigned_t<SignedInteger> abs(const SignedInteger& i)
{

Synopsis

#include <include/type_safe/integer.hpp>

template <typename SignedInteger, class Policy, typename = typename std::enable_if<std::is_signed<SignedInteger>::value>::type>
constexpr TYPE_SAFE_FORCE_INLINE make_unsigned_t< integer< SignedInteger, Policy > > abs(const integer< SignedInteger, Policy > &i)

Description

Returns
The absolute value of an [ts::integer](). \module types
Parameters

2 - \exclude

Mentioned in

Source

Lines 424-428 in include/type_safe/integer.hpp.

template <typename SignedInteger, class Policy,
          typename = typename std::enable_if<std::is_signed<SignedInteger>::value>::type>
TYPE_SAFE_FORCE_INLINE constexpr make_unsigned_t<integer<SignedInteger, Policy>> abs(
    const integer<SignedInteger, Policy>& i)
{

Synopsis

#include <include/type_safe/integer.hpp>

template <typename UnsignedInteger, typename = typename std::enable_if<std::is_unsigned<UnsignedInteger>::value>::type>
constexpr TYPE_SAFE_FORCE_INLINE UnsignedInteger abs(const UnsignedInteger &i)

Description

Returns
i unchanged. \notes This is an optimization of abs() for unsigned integer types. \module types
Parameters

1 - \exclude

Mentioned in

Source

Lines 437-440 in include/type_safe/integer.hpp.

template <typename UnsignedInteger,
          typename = typename std::enable_if<std::is_unsigned<UnsignedInteger>::value>::type>
TYPE_SAFE_FORCE_INLINE constexpr UnsignedInteger abs(const UnsignedInteger& i)
{

Synopsis

#include <include/type_safe/integer.hpp>

template <typename UnsignedInteger, class Policy, typename = typename std::enable_if<std::is_unsigned<UnsignedInteger>::value>::type>
constexpr TYPE_SAFE_FORCE_INLINE integer< UnsignedInteger, Policy > abs(const integer< UnsignedInteger, Policy > &i)

Description

Returns
i unchanged. \notes This is an optimization of abs() for unsigned integer types. \module types
Parameters

2 - \exclude

Mentioned in

Source

Lines 449-453 in include/type_safe/integer.hpp.

template <typename UnsignedInteger, class Policy,
          typename = typename std::enable_if<std::is_unsigned<UnsignedInteger>::value>::type>
TYPE_SAFE_FORCE_INLINE constexpr integer<UnsignedInteger, Policy> abs(
    const integer<UnsignedInteger, Policy>& i)
{





Add Discussion as Guest

Log in