13#  ifdef __INTEL_COMPILER 
   14#   pragma warning(disable:2557) 
   16#   pragma warning(disable:4018) 
   27template <
class D,
class T>
 
   28constexpr D 
to(
const T &t) {
 
   30    D ret =  
static_cast<D
>(t);
 
   32    T back = 
static_cast<T
>(ret);
 
   34        throw std::runtime_error(
"Numeric Conversion error.");
 
 
   42inline constexpr float to(
const double& t) {
 
   43    float f = 
static_cast<float>(t);
 
   47        throw std::runtime_error(
"Numeric Conversion error.");
 
   52constexpr D 
to(
const double& d) {
 
   55        throw std::runtime_error(
"Numeric Conversion error.");
 
   57        throw std::runtime_error(
"Numeric Conversion error.");
 
   60    D ret = 
static_cast<D
>(d);
 
   64D 
constexpr to(
const float &d) {
 
   67        throw std::runtime_error(
"Numeric Conversion error.");
 
   69        throw std::runtime_error(
"Numeric Conversion error.");
 
   71    D ret = 
static_cast<D
>(d);
 
   75inline constexpr double to(
const float &d) {
 
   76    double ret = 
static_cast<double>(d);
 
   80# pragma warning(default:4018) 
   88template <
class D,
class T>
 
   92    D *d2 = 
dynamic_cast<D *
>(t);
 
 
  103template <
class D,
class T>
 
  105    const D *d = (
const D *)t;
 
  106    assert(
dynamic_cast<const D *
>(t)==d);
 
 
  120[[clang::optnone]] constexpr const T 
safeDiv(const T num,const T denom,const T safeVal=0) {
 
  122    if (std::abs(denom) <= std::abs(num*safeFac)) 
 
 
  127[[clang::optnone]] 
static inline double safeSquare(
const double v) {
 
  128    static constexpr double maxRad = 1e150;
 
  129    if (std::abs(v)>maxRad) 
return std::abs(v);
 
  136    template <
typename U>
 
  138        using type = 
typename std::conditional<
 
  139            std::is_const<U>::value,
 
  140            typename std::add_const<T>::type,
 
  141            typename std::remove_const<T>::type
 
 
 
debug checked shorthand for std::numeric_limits<T>::
Definition limit.h:25
D * check_cast(T *t)
This template function serves as a fast alternative to dynamic_cast, when you know the base offset is...
Definition to.h:89
PUSHWARNING constexpr const T safeDiv(const T num, const T denom, const T safeVal=0)
This function provids "safe" division operation, checks explicitly for zero.
Definition to.h:120
constexpr D to(const T &t)
This template function serves as an alternative to static_cast<T>().
Definition to.h:28
std::numeric_limits shorthand, with debug overflow checking