26 #ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_NUMBER_H_
27 #define ELEMENTSKERNEL_ELEMENTSKERNEL_NUMBER_H_
29 #include <type_traits>
46 template<
typename TargetType,
typename SourceType>
53 TargetType t =
static_cast<TargetType
>(
s);
55 if (is_floating_point<SourceType>::value && is_integral<TargetType>::value) {
56 t =
static_cast<TargetType
>(round(s));
64 #endif // ELEMENTSKERNEL_ELEMENTSKERNEL_NUMBER_H_
defines the macros to be used for explicit export of the symbols
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
ELEMENTS_API TargetType numberCast(const SourceType &s)
this function is a number cast. It behaves exactly as a static_cast except when casting from a floati...