summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorjsbell <jsbell@chromium.org>2015-11-20 11:13:05 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-20 19:14:39 +0000
commit52f895d6c77181392b2c8619d70b0301fd7a9635 (patch)
tree08c35d0c33c51fcba6e7aa389a2f5d5a41c86179 /cc
parent79cf61808b98e9cfcc70b3751c77cbccfd728a55 (diff)
downloadchromium_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')
-rw-r--r--cc/quads/render_pass_id.h5
-rw-r--r--cc/surfaces/surface_sequence.h7
2 files changed, 7 insertions, 5 deletions
diff --git a/cc/quads/render_pass_id.h b/cc/quads/render_pass_id.h
index 9c36f32..f6ab9ce 100644
--- a/cc/quads/render_pass_id.h
+++ b/cc/quads/render_pass_id.h
@@ -5,6 +5,8 @@
#ifndef CC_QUADS_RENDER_PASS_ID_H_
#define CC_QUADS_RENDER_PASS_ID_H_
+#include <tuple>
+
#include "base/basictypes.h"
#include "base/containers/hash_tables.h"
#include "cc/base/cc_export.h"
@@ -27,8 +29,7 @@ class CC_EXPORT RenderPassId {
}
bool operator!=(const RenderPassId& other) const { return !(*this == other); }
bool operator<(const RenderPassId& other) const {
- return layer_id < other.layer_id ||
- (layer_id == other.layer_id && index < other.index);
+ return std::tie(layer_id, index) < std::tie(other.layer_id, other.index);
}
};
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