Replaces some overrides with final for minor performance gains.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-10-15 17:54:06 +02:00
parent edaa9f496d
commit c3606c25f6
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
3 changed files with 13 additions and 13 deletions

View File

@ -34,7 +34,7 @@ namespace ArbUt {
} }
/// @brief Returns the error message of the exception. /// @brief Returns the error message of the exception.
[[nodiscard]] const char* what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW override { [[nodiscard]] const char* what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW final {
return logic_error::what(); return logic_error::what();
} }

View File

@ -115,19 +115,19 @@ namespace ArbUt {
/// @brief Returns null-terminated C string. /// @brief Returns null-terminated C string.
/// @return Null-terminated C string. /// @return Null-terminated C string.
[[nodiscard]] inline const char* c_str() const noexcept override { return _str->GetValue(); } [[nodiscard]] inline const char* c_str() const noexcept final { return _str->GetValue(); }
/// @brief Returns std string_view of internal C string. /// @brief Returns std string_view of internal C string.
/// @return std::string_view. /// @return std::string_view.
[[nodiscard]] inline std::string_view std_str() const noexcept override { return _str->GetValue(); } [[nodiscard]] inline std::string_view std_str() const noexcept final { return _str->GetValue(); }
inline constexpr bool operator==(const std::string_view& rhs) const noexcept override { inline constexpr bool operator==(const std::string_view& rhs) const noexcept final {
return _hash == Hash(rhs.data()); return _hash == Hash(rhs.data());
} }
inline constexpr bool operator!=(const std::string_view& rhs) const noexcept override { inline constexpr bool operator!=(const std::string_view& rhs) const noexcept final {
return _hash != Hash(rhs.data()); return _hash != Hash(rhs.data());
} }
inline constexpr bool operator==(const char* rhs) const noexcept override { return _hash == Hash(rhs); } inline constexpr bool operator==(const char* rhs) const noexcept final { return _hash == Hash(rhs); }
inline constexpr bool operator!=(const char* rhs) const noexcept override { return _hash != Hash(rhs); } inline constexpr bool operator!=(const char* rhs) const noexcept final { return _hash != Hash(rhs); }
/// @brief Calculates the hash for a given C string. /// @brief Calculates the hash for a given C string.
/// @param val A null-terminated C string. /// @param val A null-terminated C string.

View File

@ -20,8 +20,8 @@ namespace ArbUt {
/// @brief Compile time initialisation of a StringViewLiteral. Length is calculated at compile. /// @brief Compile time initialisation of a StringViewLiteral. Length is calculated at compile.
/// @param str A null terminated C string. /// @param str A null terminated C string.
constexpr StringViewLiteral(const char* str) noexcept : StringViewLiteral(str, CalcLength(str)){}; constexpr StringViewLiteral(const char* str) noexcept : StringViewLiteral(str, CalcLength(str)){};
[[nodiscard]] inline constexpr const char* c_str() const noexcept override { return _str; } [[nodiscard]] inline constexpr const char* c_str() const noexcept final { return _str; }
[[nodiscard]] constexpr std::string_view std_str() const noexcept override { [[nodiscard]] constexpr std::string_view std_str() const noexcept final {
return std::string_view(_str, _length); return std::string_view(_str, _length);
} }
/// @brief Returns the hash of a s.tringview literal. /// @brief Returns the hash of a s.tringview literal.
@ -32,14 +32,14 @@ namespace ArbUt {
/// @return A normal StringView. /// @return A normal StringView.
inline operator StringView() const noexcept { return StringView(*this, _str, _length); } inline operator StringView() const noexcept { return StringView(*this, _str, _length); }
inline constexpr bool operator==(const std::string_view& rhs) const noexcept override { inline constexpr bool operator==(const std::string_view& rhs) const noexcept final {
return _hash == Hash(rhs.data()); return _hash == Hash(rhs.data());
} }
inline constexpr bool operator!=(const std::string_view& rhs) const noexcept override { inline constexpr bool operator!=(const std::string_view& rhs) const noexcept final {
return _hash != Hash(rhs.data()); return _hash != Hash(rhs.data());
} }
inline constexpr bool operator==(const char* rhs) const noexcept override { return _hash == Hash(rhs); } inline constexpr bool operator==(const char* rhs) const noexcept final { return _hash == Hash(rhs); }
inline constexpr bool operator!=(const char* rhs) const noexcept override { return _hash != Hash(rhs); } inline constexpr bool operator!=(const char* rhs) const noexcept final { return _hash != Hash(rhs); }
}; };
} }