DGtal  1.2.0
Public Types | Static Public Member Functions | Private Types
DGtal::NumberTraitsImpl< T, typename std::enable_if< std::is_integral< T >::value >::type > Struct Template Reference

Specialization of NumberTraitsImpl for fundamental integer types. More...

#include <DGtal/kernel/NumberTraits.h>

Inheritance diagram for DGtal::NumberTraitsImpl< T, typename std::enable_if< std::is_integral< T >::value >::type >:
[legend]

Public Types

using SignedVersion = typename std::make_signed< T >::type
 Alias to the signed version of the number type. More...
 
using UnsignedVersion = typename std::make_unsigned< T >::type
 Alias to the unsigned version of the number type. More...
 
- Public Types inherited from DGtal::details::NumberTraitsImplFundamental< T >
using IsBounded = typename BoolToTag< NL::is_bounded >::type
 Is the number bounded. More...
 
using IsUnsigned = typename BoolToTag<!NL::is_signed >::type
 Is the number unsigned. More...
 
using IsSigned = typename BoolToTag< NL::is_signed >::type
 Is the number signed. More...
 
using IsIntegral = typename BoolToTag< NL::is_integer >::type
 Is the number of integral type. More...
 
using IsSpecialized = TagTrue
 Is that a number type with specific traits. More...
 
using ReturnType = T
 Alias to the type that should be used as return type. More...
 
using ParamType = typename boost::call_traits< T >::param_type
 Defines a type that represents the "best" way to pass a parameter of type T to a function. More...
 

Static Public Member Functions

static constexpr bool even (typename NTIF::ParamType aT) noexcept
 Check the parity of a number. More...
 
static constexpr bool odd (typename NTIF::ParamType aT) noexcept
 Check the parity of a number. More...
 
- Static Public Member Functions inherited from DGtal::details::NumberTraitsImplFundamental< T >
static constexpr ReturnType zero () noexcept
 Return the zero of this integer. More...
 
static constexpr ReturnType one () noexcept
 Return the one of this integer. More...
 
static constexpr ReturnType min () noexcept
 Return the minimum possible value for this type of number. More...
 
static constexpr ReturnType max () noexcept
 Return the maximum possible value for this type of number. More...
 
static constexpr unsigned int digits () noexcept
 Return the number of significant binary digits for this type of number. More...
 
static constexpr BoundEnum isBounded () noexcept
 Return the bounding type of the number. More...
 
static constexpr SignEnum isSigned () noexcept
 Return the sign type of the number. More...
 
static constexpr DGtal::int64_t castToInt64_t (const T &aT) noexcept
 Cast method to DGtal::int64_t (for I/O or board export uses only). More...
 
static constexpr double castToDouble (const T &aT) noexcept
 Cast method to double (for I/O or board export uses only). More...
 
static constexpr bool even (ParamType aT) noexcept
 Check the parity of a number. More...
 
static constexpr bool odd (ParamType aT) noexcept
 Check the parity of a number. More...
 

Private Types

using NTIF = typename details::NumberTraitsImplFundamental< T >
 Internal type alias to avoid repetitions. More...
 

Additional Inherited Members

- Static Public Attributes inherited from DGtal::details::NumberTraitsImplFundamental< T >
static constexpr T ZERO = T(0)
 Constant Zero. More...
 
static constexpr T ONE = T(1)
 Constant One. More...
 

Detailed Description

template<typename T>
struct DGtal::NumberTraitsImpl< T, typename std::enable_if< std::is_integral< T >::value >::type >

Specialization of NumberTraitsImpl for fundamental integer types.

Definition at line 336 of file NumberTraits.h.

Member Typedef Documentation

◆ NTIF

template<typename T >
using DGtal::NumberTraitsImpl< T, typename std::enable_if< std::is_integral< T >::value >::type >::NTIF = typename details::NumberTraitsImplFundamental<T>
private

Internal type alias to avoid repetitions.

Definition at line 340 of file NumberTraits.h.

◆ SignedVersion

template<typename T >
using DGtal::NumberTraitsImpl< T, typename std::enable_if< std::is_integral< T >::value >::type >::SignedVersion = typename std::make_signed<T>::type

Alias to the signed version of the number type.

Definition at line 343 of file NumberTraits.h.

◆ UnsignedVersion

template<typename T >
using DGtal::NumberTraitsImpl< T, typename std::enable_if< std::is_integral< T >::value >::type >::UnsignedVersion = typename std::make_unsigned<T>::type

Alias to the unsigned version of the number type.

Definition at line 344 of file NumberTraits.h.

Member Function Documentation

◆ even()

template<typename T >
static constexpr bool DGtal::NumberTraitsImpl< T, typename std::enable_if< std::is_integral< T >::value >::type >::even ( typename NTIF::ParamType  aT)
inlinestaticconstexprnoexcept

Check the parity of a number.

Parameters
aTany number.
Returns
'true' iff the number is even.

Definition at line 352 of file NumberTraits.h.

353  {
354  return ( aT & NTIF::ONE ) == NTIF::ZERO;
355  }
static const T ONE
Constant One.
Definition: NumberTraits.h:103
static const T ZERO
Constant Zero.
Definition: NumberTraits.h:100

◆ odd()

template<typename T >
static constexpr bool DGtal::NumberTraitsImpl< T, typename std::enable_if< std::is_integral< T >::value >::type >::odd ( typename NTIF::ParamType  aT)
inlinestaticconstexprnoexcept

Check the parity of a number.

Parameters
aTany number.
Returns
'true' iff the number is odd.

Definition at line 363 of file NumberTraits.h.

364  {
365  return ( aT & NTIF::ONE ) != NTIF::ZERO;
366  }

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