From b6eae08e1d5988091842bf86c48212abf4ccb974 Mon Sep 17 00:00:00 2001
From: Martin Stump <martin.stump@mercedes-benz.com>
Date: Wed, 10 May 2023 14:37:04 +0200
Subject: [PATCH] Add noexcept specifier

Signed-off-by: Martin Stump <martin.stump@mercedes-benz.com>
---
 include/MantleAPI/Common/floating_point_helper.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/MantleAPI/Common/floating_point_helper.h b/include/MantleAPI/Common/floating_point_helper.h
index dc6e61f..e0c4e6f 100644
--- a/include/MantleAPI/Common/floating_point_helper.h
+++ b/include/MantleAPI/Common/floating_point_helper.h
@@ -43,7 +43,7 @@ namespace details
 {
 
 template <typename T, std::enable_if_t<std::is_arithmetic_v<T>, bool> = true>
-constexpr int signum(const T value)
+constexpr int signum(const T value) noexcept
 {
   return (T{0} < value) - (value < T{0});
 }
@@ -62,7 +62,7 @@ inline constexpr auto kDefaultEps = MANTLE_API_DEFAULT_EPS;
 /// \param[in] epsilon The epsilon for floating-point comparison. Defaults to kDefaultEps.
 ///
 template <typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
-constexpr bool AlmostEqual(const T lhs, const T rhs, const T epsilon = static_cast<T>(kDefaultEps))
+constexpr bool AlmostEqual(const T lhs, const T rhs, const T epsilon = static_cast<T>(kDefaultEps)) noexcept
 {
   // Handle NaN.
   // NaN should never be equal to anything.
@@ -103,7 +103,7 @@ constexpr bool AlmostEqual(const T lhs, const T rhs, const T epsilon = static_ca
 /// \param[in] epsilon The epsilon for floating-point comparison. Defaults to kDefaultEps.
 ///
 template <typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
-constexpr bool GreaterOrEqual(const T lhs, const T rhs, const T epsilon = static_cast<T>(kDefaultEps))
+constexpr bool GreaterOrEqual(const T lhs, const T rhs, const T epsilon = static_cast<T>(kDefaultEps)) noexcept
 {
   if (lhs > rhs)
   {
@@ -121,7 +121,7 @@ constexpr bool GreaterOrEqual(const T lhs, const T rhs, const T epsilon = static
 /// \param[in] epsilon The epsilon for floating-point comparison. Defaults to kDefaultEps.
 ///
 template <typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
-constexpr bool LessOrEqual(const T lhs, const T rhs, const T epsilon = static_cast<T>(kDefaultEps))
+constexpr bool LessOrEqual(const T lhs, const T rhs, const T epsilon = static_cast<T>(kDefaultEps)) noexcept
 {
   if (lhs < rhs)
   {
@@ -139,7 +139,7 @@ constexpr bool LessOrEqual(const T lhs, const T rhs, const T epsilon = static_ca
 /// \param[in] epsilon The epsilon for floating-point comparison. Defaults to kDefaultEps.
 ///
 template <typename T, std::enable_if_t<units::traits::is_unit_t<T>::value, bool> = true>
-constexpr bool AlmostEqual(const T lhs, const T rhs, const T epsilon = T{kDefaultEps})
+constexpr bool AlmostEqual(const T lhs, const T rhs, const T epsilon = T{kDefaultEps}) noexcept
 {
   return AlmostEqual(lhs(), rhs(), epsilon());
 }
@@ -152,7 +152,7 @@ constexpr bool AlmostEqual(const T lhs, const T rhs, const T epsilon = T{kDefaul
 /// \param[in] epsilon The epsilon for floating-point comparison. Defaults to kDefaultEps.
 ///
 template <typename T, std::enable_if_t<units::traits::is_unit_t<T>::value, bool> = true>
-constexpr bool GreaterOrEqual(const T lhs, const T rhs, const T epsilon = T{kDefaultEps})
+constexpr bool GreaterOrEqual(const T lhs, const T rhs, const T epsilon = T{kDefaultEps}) noexcept
 {
   return GreaterOrEqual(lhs(), rhs(), epsilon());
 }
@@ -165,7 +165,7 @@ constexpr bool GreaterOrEqual(const T lhs, const T rhs, const T epsilon = T{kDef
 /// \param[in] epsilon The epsilon for floating-point comparison. Defaults to kDefaultEps.
 ///
 template <typename T, std::enable_if_t<units::traits::is_unit_t<T>::value, bool> = true>
-constexpr bool LessOrEqual(const T lhs, const T rhs, const T epsilon = T{kDefaultEps})
+constexpr bool LessOrEqual(const T lhs, const T rhs, const T epsilon = T{kDefaultEps}) noexcept
 {
   return LessOrEqual(lhs(), rhs(), epsilon());
 }
-- 
GitLab