diff options
author | jsbell <jsbell@chromium.org> | 2015-11-20 11:13:05 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-20 19:14:39 +0000 |
commit | 52f895d6c77181392b2c8619d70b0301fd7a9635 (patch) | |
tree | 08c35d0c33c51fcba6e7aa389a2f5d5a41c86179 /cc/surfaces | |
parent | 79cf61808b98e9cfcc70b3751c77cbccfd728a55 (diff) | |
download | chromium_src-52f895d6c77181392b2c8619d70b0301fd7a9635.zip chromium_src-52f895d6c77181392b2c8619d70b0301fd7a9635.tar.gz chromium_src-52f895d6c77181392b2c8619d70b0301fd7a9635.tar.bz2 |
Use std::tie() for operator< in cc/
Simplify the code for operator< when comparing multiple members using
a common std::tie idiom.
BUG=555171
R=danakj@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1463623002
Cr-Commit-Position: refs/heads/master@{#360872}
Diffstat (limited to 'cc/surfaces')
-rw-r--r-- | cc/surfaces/surface_sequence.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cc/surfaces/surface_sequence.h b/cc/surfaces/surface_sequence.h index 72f4bc9..b579296 100644 --- a/cc/surfaces/surface_sequence.h +++ b/cc/surfaces/surface_sequence.h @@ -5,6 +5,8 @@ #ifndef CC_SURFACES_SURFACE_SEQUENCE_H_ #define CC_SURFACES_SURFACE_SEQUENCE_H_ +#include <tuple> + #include "base/containers/hash_tables.h" namespace cc { @@ -31,9 +33,8 @@ inline bool operator!=(const SurfaceSequence& a, const SurfaceSequence& b) { } inline bool operator<(const SurfaceSequence& a, const SurfaceSequence& b) { - if (a.id_namespace != b.id_namespace) - return a.id_namespace < b.id_namespace; - return a.sequence < b.sequence; + return std::tie(a.id_namespace, a.sequence) < + std::tie(b.id_namespace, b.sequence); } } // namespace cc |