Index: ipc/brokerable_attachment.h |
diff --git a/ipc/brokerable_attachment.h b/ipc/brokerable_attachment.h |
index ce3082cd92b8986557d9245f5799567feb22aa06..6761f22a7126daf5875e7fdfa44238e5508042b4 100644 |
--- a/ipc/brokerable_attachment.h |
+++ b/ipc/brokerable_attachment.h |
@@ -7,6 +7,8 @@ |
#include <stdint.h> |
+#include <algorithm> |
+ |
#include "base/macros.h" |
#include "ipc/ipc_export.h" |
#include "ipc/ipc_message_attachment.h" |
@@ -37,21 +39,12 @@ class IPC_EXPORT BrokerableAttachment : public MessageAttachment { |
void SerializeToBuffer(char* start_address, size_t size); |
bool operator==(const AttachmentId& rhs) const { |
- for (size_t i = 0; i < kNonceSize; ++i) { |
- if (nonce[i] != rhs.nonce[i]) |
- return false; |
- } |
- return true; |
+ return std::equal(nonce, nonce + kNonceSize, rhs.nonce); |
} |
bool operator<(const AttachmentId& rhs) const { |
- for (size_t i = 0; i < kNonceSize; ++i) { |
- if (nonce[i] < rhs.nonce[i]) |
- return true; |
- if (nonce[i] > rhs.nonce[i]) |
- return false; |
- } |
- return false; |
+ return std::lexicographical_compare(nonce, nonce + kNonceSize, rhs.nonce, |
+ rhs.nonce + kNonceSize); |
} |
}; |