35#ifndef NEKTAR_LIB_UTILITIES_CHECKEDCAST_H
36#define NEKTAR_LIB_UTILITIES_CHECKEDCAST_H
47 class =
typename std::enable_if<
48 std::is_floating_point_v<typename std::remove_reference<Ti>::type> &&
49 std::is_integral_v<typename std::remove_reference<To>::type>>::type>
52 Ti min = std::numeric_limits<To>::min();
53 Ti max = std::numeric_limits<To>::max();
54 ASSERTL0(param >= min,
"Casting would narrow (underflow).");
55 ASSERTL0(param <= max,
"Casting would narrow (overflow).");
56 return static_cast<To
>(param);
#define ASSERTL0(condition, msg)
To checked_cast(const Ti param)
checked cast from float types only to int types