Skip to content

Commit

Permalink
Add TRange contains(TRange&) overload
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 committed Oct 20, 2023
1 parent c3834dc commit b3486df
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sming/Core/Data/Range.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ template <typename T> struct TRange {
return (value >= min) && (value <= max);
}

/**
* @brief Determine if range contains another range (subset)
*/
template <typename Q> bool contains(const TRange<Q>& value) const
{
return contains(value.min) && contains(value.max);
}

/**
* @brief Clip values to within the range
*/
Expand Down

0 comments on commit b3486df

Please sign in to comment.