8 #include "boost/call_traits.hpp" 9 #include "boost/type_traits.hpp" 10 #include "boost/utility/enable_if.hpp" 47 template <
typename T >
51 #define TIL_DEFINE_PRECISION_FOR_NUMERIC_TYPES(argtype) \ 53 struct precision< argtype > \ 54 { typedef argtype type; }; 63 #undef TIL_DEFINE_PRECISION_FOR_NUMERIC_TYPES 68 #define DEFINE_PRECISION_RECURSIVE_SPECIALIZATION_T(argtype, targs) \ 70 struct precision< argtype > \ 71 { typedef typename precision<T>::type type; } \ 73 #define DEFINE_PRECISION_RECURSIVE_SPECIALIZATION(argtype) \ 74 DEFINE_PRECISION_RECURSIVE_SPECIALIZATION_T(argtype, typename T) 95 #undef DEFINE_PRECISION_RECURSIVE_SPECIALIZATION 105 template <
typename T,
typename TNewPrecision >
110 #define TIL_DEFINE_CHANGE_PRECISION_FOR_NUMERIC_TYPES(argtype) \ 111 template < typename TNewPrecision > \ 112 struct change_precision< argtype, TNewPrecision > \ 114 typedef TNewPrecision type; \ 116 typedef typename enable_if_c<std::numeric_limits<TNewPrecision>::is_specialized>::type CheckIsNumeric; \ 121 #undef TIL_DEFINE_CHANGE_PRECISION_FOR_NUMERIC_TYPES 126 #define TIL_DEFINE_CHANGE_PRECISION_RECURSIVE_SPECIALIZATION_T(argtype, targs) \ 127 template < targs , typename TNewPrecision> \ 128 struct change_precision< argtype , TNewPrecision> \ 130 typedef typename change_precision<T, TNewPrecision>::type type; \ 132 typedef typename enable_if_c<std::numeric_limits<TNewPrecision>::is_specialized>::type CheckIsNumeric; \ 136 #define TIL_DEFINE_CHANGE_PRECISION_RECURSIVE_SPECIALIZATION(argtype) \ 137 TIL_DEFINE_CHANGE_PRECISION_RECURSIVE_SPECIALIZATION_T(argtype, typename T) 161 template <
typename T1,
typename T2 >
166 (!std::numeric_limits<T1>::is_integer && std::numeric_limits<T2>::is_integer) ||
168 ((!std::numeric_limits<T1>::is_integer || std::numeric_limits<T2>::is_integer) &&
170 (
sizeof(T1) >=
sizeof(T2))),
197 template <
typename T >
200 typedef typename T::value_type
type;
206 template <
typename T >
220 template <
typename T >
241 template <
typename T >
244 typedef typename T::reference
type;
247 template <
typename T >
277 template <
template <
typename>
class TReturn >
280 template <
typename T >
294 template <
typename T >
296 {
typedef typename T::range
type; };
298 template <
typename T >
300 {
typedef typename T::const_range
type; };
306 template <
typename T >
308 {
typedef typename T::const_range
type; };
318 template <
typename T >
320 :
public type_if<boost::is_const<T>::value, typename T::const_reference, typename T::reference>
330 template <
typename T >
333 :
public type_if<boost::is_empty<T>::value, T, typename boost::call_traits<T>::param_type>
343 template <
typename T >
345 :
public type_if<std::numeric_limits<T>::is_signed, true_type, false_type>::type
354 template <
typename T >
356 :
public type_if<std::numeric_limits<T>::is_integer, true_type, false_type>::type
366 template <
typename T >
368 :
public type_if<std::numeric_limits<T>::is_specialized && !std::numeric_limits<T>::is_integer, true_type, false_type>::type
377 template <
typename T >
Numerical precision of the data for storage classes.
DEFINE_PRECISION_RECURSIVE_SPECIALIZATION(ImageC< T >)
value_type_of< T >::type type
Belongs to package Box Do not include directly, include til/Box.h instead.
#define TIL_DEFINE_PRECISION_FOR_NUMERIC_TYPES(argtype)
Specialization for numerical types.
Returns T::reference or T::const_reference, depending on the constness of T.
General macros, definitions and functions.
DEFINE_PRECISION_RECURSIVE_SPECIALIZATION_T(numeric_array< T TIL_COMMA D >, typename T TIL_COMMA std::size_t D)
A type representing the absence of a type.
This file contains forward declarations of classes defined in the TIL library.
TIL_DEFINE_CHANGE_PRECISION_RECURSIVE_SPECIALIZATION(ImageC< T >)
Type return by T when unitary T::operator*() is called.
TIL_FOR_ALL_NUMERIC_TYPES(TIL_DEFINE_PRECISION_FOR_NUMERIC_TYPES)
#define TIL_DEFINE_CHANGE_PRECISION_FOR_NUMERIC_TYPES(argtype)
type_if<(!std::numeric_limits< T1 >::is_integer &&std::numeric_limits< T2 >::is_integer)||((!std::numeric_limits< T1 >::is_integer||std::numeric_limits< T2 >::is_integer) &&(sizeof(T1) >=sizeof(T2))), T1, T2 >::type type
Defines the return type of an operation between numbers of different types.
Template to choose between one type or the other depending on some condition.
Changing the numerical precision of an object.
Externalization of the standard value_type member typedef.
Return T is T is stateless^H^H^H^Hempty, otherwise boost::call_traits<T>::param_type.