Template Function rclcpp::sub_will_underflow

Function Documentation

template<typename T>
bool rclcpp::sub_will_underflow(const T x, const T y)

Safely check if subtraction will underflow.

The type of the operands, T, should have defined std::numeric_limits<T>::min(), >, < and + operators.

Parameters:
  • x[in] is the minuend.

  • y[in] is the subtrahend.

Template Parameters:

T – is type of the operands.

Returns:

True if the difference x - y sum is less than T::min value.