mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpimath] Make unit max and min constexpr (#6690)
This commit is contained in:
@@ -3408,7 +3408,7 @@ namespace units {
|
||||
// the "_min" user-defined literal in time.h.
|
||||
|
||||
template<class UnitTypeLhs, class UnitTypeRhs>
|
||||
UnitTypeLhs (min)(const UnitTypeLhs& lhs, const UnitTypeRhs& rhs)
|
||||
constexpr UnitTypeLhs (min)(const UnitTypeLhs& lhs, const UnitTypeRhs& rhs)
|
||||
{
|
||||
static_assert(traits::is_convertible_unit_t<UnitTypeLhs, UnitTypeRhs>::value, "Unit types are not compatible.");
|
||||
UnitTypeLhs r(rhs);
|
||||
@@ -3416,7 +3416,7 @@ namespace units {
|
||||
}
|
||||
|
||||
template<class UnitTypeLhs, class UnitTypeRhs>
|
||||
UnitTypeLhs (max)(const UnitTypeLhs& lhs, const UnitTypeRhs& rhs)
|
||||
constexpr UnitTypeLhs (max)(const UnitTypeLhs& lhs, const UnitTypeRhs& rhs)
|
||||
{
|
||||
static_assert(traits::is_convertible_unit_t<UnitTypeLhs, UnitTypeRhs>::value, "Unit types are not compatible.");
|
||||
UnitTypeLhs r(rhs);
|
||||
|
||||
Reference in New Issue
Block a user