Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Unified Diff: tools/gn/location.cc

Issue 1461623006: Use simplify operator< implementations in tools/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix string compare checks Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/label.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/location.cc
diff --git a/tools/gn/location.cc b/tools/gn/location.cc
index 7a18786e57cb45b73c73710ed4b06abc4268e112..59b99d6f44ec0069b8025c2208a4f942145c2a8f 100644
--- a/tools/gn/location.cc
+++ b/tools/gn/location.cc
@@ -4,6 +4,8 @@
#include "tools/gn/location.h"
+#include <tuple>
+
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "tools/gn/input_file.h"
@@ -36,9 +38,8 @@ bool Location::operator!=(const Location& other) const {
bool Location::operator<(const Location& other) const {
DCHECK(file_ == other.file_);
- if (line_number_ != other.line_number_)
- return line_number_ < other.line_number_;
- return char_offset_ < other.char_offset_;
+ return std::tie(line_number_, char_offset_) <
+ std::tie(other.line_number_, other.char_offset_);
}
std::string Location::Describe(bool include_char_offset) const {
« no previous file with comments | « tools/gn/label.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698