Skip to content

Commit

Permalink
Add noexcept to the operator== of url class
Browse files Browse the repository at this point in the history
  • Loading branch information
rmisev committed Oct 6, 2023
1 parent 3f3ece8 commit 7af1f4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/upa/url.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<url>;
friend detail::url_serializer;
friend detail::url_setter;
Expand Down Expand Up @@ -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_;
}

Expand Down
4 changes: 2 additions & 2 deletions test/test-url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<upa::url>") {
TEST_CASE("std::hash<upa::url> and operator==") {
std::unordered_map<upa::url, int> map;

map.emplace(upa::url{ "about:blank" }, 1);
Expand Down

0 comments on commit 7af1f4e

Please sign in to comment.