29 #if defined(ArithmeticConversionTraits_RECURSES)
30 #error Recursive header files inclusion detected in ArithmeticConversionTraits.h
33 #define ArithmeticConversionTraits_RECURSES
35 #if !defined ArithmeticConversionTraits_h
37 #define ArithmeticConversionTraits_h
41 #include <type_traits>
42 #include "DGtal/base/Common.h"
91 template <
typename T,
typename U,
typename Enable =
void>
100 template <
typename T,
typename U>
102 typename std::enable_if<
103 ! std::is_same< T, typename std::remove_cv< typename std::remove_reference<T>::type >::type >::value
104 || ! std::is_same< U, typename std::remove_cv< typename std::remove_reference<U>::type >::type >::value >::type >
106 typename std::remove_cv< typename std::remove_reference<T>::type >::type,
107 typename std::remove_cv< typename std::remove_reference<U>::type >::type >
119 template <
typename T,
typename U>
121 typename std::enable_if< std::is_arithmetic<T>::value
122 && std::is_arithmetic<U>::value >
::type >
124 using type =
typename std::common_type<T, U>::type;
134 template <
typename T,
typename U>
144 template <
typename T,
typename U,
typename Enable =
void>
158 template <
typename T,
typename U>
160 typename std::conditional<false, ArithmeticConversionType<T, U>, void>::type >
184 boost::ignore_unused_variable_warning(lhs);
185 boost::ignore_unused_variable_warning(rhs);
198 template <
typename T,
typename GMP1,
typename GMP2>
200 typename std::enable_if< std::is_integral<T>::value >
::type >
212 template <
typename GMP1,
typename GMP2,
typename U>
214 typename std::enable_if< std::is_integral<U>::value >
::type >
226 template <
typename GMPL1,
typename GMPL2,
typename GMPR1,
typename GMPR2>
237 #undef ArithmeticConversionTraits_RECURSES
DGtal is the top-level namespace which contains all DGtal functions and types.
typename ArithmeticConversionTraits< T, U >::type ArithmeticConversionType
Result type of arithmetic binary operators between two given types.
ArithmeticConversionType< LHS, RHS > constructFromArithmeticConversion(LHS const &lhs, RHS const &rhs, Args &&... args)
Call constructor for the result type of an arithmetic operation.
mpz_class BigInteger
Multi-precision integer with GMP implementation.
typename std::common_type< T, U >::type type
Aim: Trait class to get result type of arithmetic binary operators between two given types.
Helper to determine if an arithmetic operation between two given types has a valid result type (ie is...