From bea9c385a959659be0048049ea5604f4c16985bb Mon Sep 17 00:00:00 2001 From: jadebenn Date: Fri, 2 Feb 2024 18:06:24 -0600 Subject: [PATCH] Update noexcept attributes (verified these are correct) --- dCommon/GeneralUtils.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dCommon/GeneralUtils.h b/dCommon/GeneralUtils.h index 5b9ca4de..03a06283 100644 --- a/dCommon/GeneralUtils.h +++ b/dCommon/GeneralUtils.h @@ -156,7 +156,7 @@ namespace GeneralUtils { * @returns An std::optional containing the desired value if it exists in the string */ template - [[nodiscard]] std::optional TryParse(const char* const str, const char* const strEnd = NULL) { + [[nodiscard]] std::optional TryParse(const char* const str, const char* const strEnd = NULL) noexcept { numeric_parse_t result; const bool isParsed = std::from_chars(str, strEnd, result).ec == std::errc{}; @@ -183,7 +183,7 @@ namespace GeneralUtils { * @returns An std::optional containing the desired value if it exists in the string */ template - [[nodiscard]] std::optional TryParse(const std::string& str) { + [[nodiscard]] std::optional TryParse(const std::string& str) noexcept { return TryParse(str.data(), str.data() + str.size()); } @@ -193,7 +193,7 @@ namespace GeneralUtils { * @returns An std::optional containing the desired value if it exists in the string */ template - [[nodiscard]] std::optional TryParse(const std::string_view str) { + [[nodiscard]] std::optional TryParse(const std::string_view str) noexcept { return TryParse(str.data(), str.data() + str.size()); } @@ -205,7 +205,7 @@ namespace GeneralUtils { * @returns An std::optional containing the desired NiPoint3 if it can be constructed from the string parameters */ template - [[nodiscard]] std::optional TryParse(const std::string& strX, const std::string& strY, const std::string& strZ) { + [[nodiscard]] std::optional TryParse(const std::string& strX, const std::string& strY, const std::string& strZ) noexcept { const auto x = TryParse(strX); const auto y = TryParse(strY); const auto z = TryParse(strZ); @@ -219,7 +219,7 @@ namespace GeneralUtils { * @returns An std::optional containing the desired NiPoint3 if it can be constructed from the string parameters */ template - [[nodiscard]] std::optional TryParse(const std::vector& str) { + [[nodiscard]] std::optional TryParse(const std::vector& str) noexcept { return TryParse(str.at(0), str.at(1), str.at(2)); } @@ -230,7 +230,7 @@ namespace GeneralUtils { // From boost::hash_combine template - void hash_combine(std::size_t& s, const T& v) { + constexpr void hash_combine(std::size_t& s, const T& v) noexcept { std::hash h; s ^= h(v) + 0x9e3779b9 + (s << 6) + (s >> 2); } @@ -264,7 +264,7 @@ namespace GeneralUtils { * @returns The enum entry's value in its underlying type */ template - constexpr typename std::underlying_type_t CastUnderlyingType(const eType entry) { + constexpr typename std::underlying_type_t CastUnderlyingType(const eType entry) noexcept { return static_cast>(entry); }