From 7af1f4e913811af389eee76471128581fda1cb30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rimas=20Misevi=C4=8Dius?= Date: Fri, 6 Oct 2023 16:09:13 +0300 Subject: [PATCH] Add noexcept to the operator== of url class --- include/upa/url.h | 4 ++-- test/test-url.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/upa/url.h b/include/upa/url.h index ef2c03a..be68586 100644 --- a/include/upa/url.h +++ b/include/upa/url.h @@ -626,7 +626,7 @@ class url { std::size_t path_segment_count_ = 0; detail::url_search_params_ptr search_params_ptr_; - friend bool operator==(const url& lhs, const url& rhs); + friend bool operator==(const url& lhs, const url& rhs) noexcept; friend struct std::hash; friend detail::url_serializer; friend detail::url_setter; @@ -2930,7 +2930,7 @@ inline bool is_unc_path(const CharT* first, const CharT* last) // URL utilities (non-member functions) /// @brief Lexicographically compares two URL's -inline bool operator==(const url& lhs, const url& rhs) { +inline bool operator==(const url& lhs, const url& rhs) noexcept { return lhs.norm_url_ == rhs.norm_url_; } diff --git a/test/test-url.cpp b/test/test-url.cpp index d383ebf..1a49268 100644 --- a/test/test-url.cpp +++ b/test/test-url.cpp @@ -568,9 +568,9 @@ TEST_CASE("url_from_file_path") { } } -// Test operator== and std::hash specialization +// Test std::hash specialization and operator== -TEST_CASE("operator== && std::hash") { +TEST_CASE("std::hash and operator==") { std::unordered_map map; map.emplace(upa::url{ "about:blank" }, 1);