diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-03 20:26:46 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-03 20:26:46 +0000 |
commit | 88f3c7e54009b96f635dc7a2581e3424e9b7c034 (patch) | |
tree | 84ad3ba561945f1d21740f9337148ee899f0036b /include/clang/Edit | |
parent | e1e6798cc7a56ce249c97ab470033e446acb66ba (diff) |
[C++11] Simplify compare operators with std::tie.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Edit')
-rw-r--r-- | include/clang/Edit/FileOffset.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/include/clang/Edit/FileOffset.h b/include/clang/Edit/FileOffset.h index 675ad18fcd..0c1e72b84e 100644 --- a/include/clang/Edit/FileOffset.h +++ b/include/clang/Edit/FileOffset.h @@ -41,20 +41,16 @@ public: return !(LHS == RHS); } friend bool operator<(FileOffset LHS, FileOffset RHS) { - if (LHS.FID != RHS.FID) - return LHS.FID < RHS.FID; - return LHS.Offs < RHS.Offs; + return std::tie(LHS.FID, LHS.Offs) < std::tie(RHS.FID, RHS.Offs); } friend bool operator>(FileOffset LHS, FileOffset RHS) { - if (LHS.FID != RHS.FID) - return LHS.FID > RHS.FID; - return LHS.Offs > RHS.Offs; + return RHS < LHS; } friend bool operator>=(FileOffset LHS, FileOffset RHS) { - return LHS > RHS || LHS == RHS; + return !(LHS < RHS); } friend bool operator<=(FileOffset LHS, FileOffset RHS) { - return LHS < RHS || LHS == RHS; + return !(RHS < LHS); } }; |