diff options
author | jsbell <jsbell@chromium.org> | 2015-11-30 15:17:41 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-30 23:18:34 +0000 |
commit | 938b02521e5ab975a588a1fe3d69e5d624efbfb2 (patch) | |
tree | 73b6b24646a498bda612e06a9a8a454ed488561d /url | |
parent | 246f10249c9f4d9992e85167d67257a5e2a2f259 (diff) | |
download | chromium_src-938b02521e5ab975a588a1fe3d69e5d624efbfb2.zip chromium_src-938b02521e5ab975a588a1fe3d69e5d624efbfb2.tar.gz chromium_src-938b02521e5ab975a588a1fe3d69e5d624efbfb2.tar.bz2 |
Use std::tie() for operator< in url/
Simplify the code for operator< when comparing multiple members using
a common std::tie idiom.
BUG=555171
R=brettw@chromium.org
Review URL: https://codereview.chromium.org/1457683008
Cr-Commit-Position: refs/heads/master@{#362262}
Diffstat (limited to 'url')
-rw-r--r-- | url/scheme_host_port.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/url/scheme_host_port.cc b/url/scheme_host_port.cc index 7747365..6e84b184 100644 --- a/url/scheme_host_port.cc +++ b/url/scheme_host_port.cc @@ -6,6 +6,8 @@ #include <string.h> +#include <tuple> + #include "base/logging.h" #include "base/numerics/safe_conversions.h" #include "base/strings/string_number_conversions.h" @@ -170,13 +172,8 @@ bool SchemeHostPort::Equals(const SchemeHostPort& other) const { } bool SchemeHostPort::operator<(const SchemeHostPort& other) const { - if (port_ != other.port_) - return port_ < other.port_; - if (scheme_ != other.scheme_) - return scheme_ < other.scheme_; - if (host_ != other.host_) - return host_ < other.host_; - return false; + return std::tie(port_, scheme_, host_) < + std::tie(other.port_, other.scheme_, other.host_); } } // namespace url |