mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
@@ -2328,7 +2328,7 @@ namespace units
|
||||
|
||||
// unary addition: +T
|
||||
template<class Units, typename T, template<typename> class NonLinearScale>
|
||||
inline unit_t<Units, T, NonLinearScale> operator+(const unit_t<Units, T, NonLinearScale>& u) noexcept
|
||||
constexpr inline unit_t<Units, T, NonLinearScale> operator+(const unit_t<Units, T, NonLinearScale>& u) noexcept
|
||||
{
|
||||
return u;
|
||||
}
|
||||
@@ -2352,7 +2352,7 @@ namespace units
|
||||
|
||||
// unary addition: -T
|
||||
template<class Units, typename T, template<typename> class NonLinearScale>
|
||||
inline unit_t<Units, T, NonLinearScale> operator-(const unit_t<Units, T, NonLinearScale>& u) noexcept
|
||||
constexpr inline unit_t<Units, T, NonLinearScale> operator-(const unit_t<Units, T, NonLinearScale>& u) noexcept
|
||||
{
|
||||
return unit_t<Units, T, NonLinearScale>(-u());
|
||||
}
|
||||
|
||||
@@ -3063,14 +3063,17 @@ TEST_F(Constexpr, construction) {
|
||||
constexpr meter_t result0(0);
|
||||
constexpr auto result1 = make_unit<meter_t>(1);
|
||||
constexpr auto result2 = meter_t(2);
|
||||
constexpr auto result3 = -3_m;
|
||||
|
||||
EXPECT_EQ(meter_t(0), result0);
|
||||
EXPECT_EQ(meter_t(1), result1);
|
||||
EXPECT_EQ(meter_t(2), result2);
|
||||
EXPECT_EQ(meter_t(-3), result3);
|
||||
|
||||
EXPECT_TRUE(noexcept(result0));
|
||||
EXPECT_TRUE(noexcept(result1));
|
||||
EXPECT_TRUE(noexcept(result2));
|
||||
EXPECT_TRUE(noexcept(result3));
|
||||
}
|
||||
|
||||
TEST_F(Constexpr, constants) {
|
||||
|
||||
Reference in New Issue
Block a user