Template Function throwIfOutOfRange

Function Documentation

template<typename T1, typename T2>
void throwIfOutOfRange(const T1 &val, const T2 &min, const T2 &max, const std::string val_desc)

Throws an exception if a given value is out of a defined range.

Template Parameters:
  • T1

  • T2

Parameters:
  • val – The value to check if it is in the range.

  • min – The minimum value of the range.

  • max – The maximum value of the range.

  • val_desc – Description of the value for the exception message.