DGtal 1.3.0
|
NumberTraits common part for fundamental integer and floating-point types. More...
#include <DGtal/kernel/NumberTraits.h>
Public Types | |
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 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 DGtal::uint64_t | castToUInt64_t (const T &aT) noexcept |
Cast method to DGtal::uint64_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... | |
Static Public Attributes | |
static constexpr T | ZERO = T(0) |
Constant Zero. More... | |
static constexpr T | ONE = T(1) |
Constant One. More... | |
Private Types | |
using | NL = std::numeric_limits< T > |
Type alias to std::numeric_limits. More... | |
NumberTraits common part for fundamental integer and floating-point types.
Definition at line 213 of file NumberTraits.h.
using DGtal::details::NumberTraitsImplFundamental< T >::IsBounded = typename BoolToTag<NL::is_bounded>::type |
Is the number bounded.
Definition at line 220 of file NumberTraits.h.
using DGtal::details::NumberTraitsImplFundamental< T >::IsIntegral = typename BoolToTag<NL::is_integer>::type |
Is the number of integral type.
Definition at line 223 of file NumberTraits.h.
using DGtal::details::NumberTraitsImplFundamental< T >::IsSigned = typename BoolToTag<NL::is_signed>::type |
Is the number signed.
Definition at line 222 of file NumberTraits.h.
using DGtal::details::NumberTraitsImplFundamental< T >::IsSpecialized = TagTrue |
Is that a number type with specific traits.
Definition at line 224 of file NumberTraits.h.
using DGtal::details::NumberTraitsImplFundamental< T >::IsUnsigned = typename BoolToTag<!NL::is_signed>::type |
Is the number unsigned.
Definition at line 221 of file NumberTraits.h.
|
private |
Type alias to std::numeric_limits.
Definition at line 216 of file NumberTraits.h.
using DGtal::details::NumberTraitsImplFundamental< T >::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.
Definition at line 231 of file NumberTraits.h.
using DGtal::details::NumberTraitsImplFundamental< T >::ReturnType = T |
Alias to the type that should be used as return type.
Definition at line 226 of file NumberTraits.h.
|
inlinestaticconstexprnoexcept |
Cast method to double (for I/O or board export uses only).
Definition at line 319 of file NumberTraits.h.
|
inlinestaticconstexprnoexcept |
Cast method to DGtal::int64_t (for I/O or board export uses only).
Definition at line 299 of file NumberTraits.h.
|
inlinestaticconstexprnoexcept |
Cast method to DGtal::uint64_t (for I/O or board export uses only).
Definition at line 309 of file NumberTraits.h.
|
inlinestaticconstexprnoexcept |
Return the number of significant binary digits for this type of number.
Definition at line 269 of file NumberTraits.h.
|
inlinestaticconstexprnoexcept |
Check the parity of a number.
aT | any number. |
Definition at line 330 of file NumberTraits.h.
References DGtal::details::NumberTraitsImplFundamental< T >::ONE, and DGtal::details::NumberTraitsImplFundamental< T >::ZERO.
|
inlinestaticconstexprnoexcept |
Return the bounding type of the number.
Definition at line 279 of file NumberTraits.h.
References DGtal::BOUNDED, and DGtal::UNBOUNDED.
|
inlinestaticconstexprnoexcept |
Return the sign type of the number.
Definition at line 289 of file NumberTraits.h.
References DGtal::SIGNED, and DGtal::UNSIGNED.
|
inlinestaticconstexprnoexcept |
Return the maximum possible value for this type of number.
Definition at line 262 of file NumberTraits.h.
|
inlinestaticconstexprnoexcept |
Return the minimum possible value for this type of number.
Definition at line 255 of file NumberTraits.h.
|
inlinestaticconstexprnoexcept |
Check the parity of a number.
aT | any number. |
Definition at line 341 of file NumberTraits.h.
References DGtal::details::NumberTraitsImplFundamental< T >::ONE, and DGtal::details::NumberTraitsImplFundamental< T >::ZERO.
|
inlinestaticconstexprnoexcept |
Return the one of this integer.
Definition at line 248 of file NumberTraits.h.
References DGtal::details::NumberTraitsImplFundamental< T >::ONE.
|
inlinestaticconstexprnoexcept |
Return the zero of this integer.
Definition at line 241 of file NumberTraits.h.
References DGtal::details::NumberTraitsImplFundamental< T >::ZERO.
|
staticconstexpr |
Constant One.
Definition at line 237 of file NumberTraits.h.
Referenced by DGtal::details::NumberTraitsImplFundamental< T >::even(), DGtal::details::NumberTraitsImplFundamental< T >::odd(), and DGtal::details::NumberTraitsImplFundamental< T >::one().
|
staticconstexpr |
Constant Zero.
Definition at line 234 of file NumberTraits.h.
Referenced by DGtal::details::NumberTraitsImplFundamental< T >::even(), DGtal::details::NumberTraitsImplFundamental< T >::odd(), and DGtal::details::NumberTraitsImplFundamental< T >::zero().