OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_CONTAINERS_CONTAINER_TEST_UTILS_H_ | 5 #ifndef BASE_CONTAINERS_CONTAINER_TEST_UTILS_H_ |
6 #define BASE_CONTAINERS_CONTAINER_TEST_UTILS_H_ | 6 #define BASE_CONTAINERS_CONTAINER_TEST_UTILS_H_ |
7 | 7 |
8 // This file contains some helper classes for testing conainer behavior. | 8 // This file contains some helper classes for testing conainer behavior. |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 } | 23 } |
24 | 24 |
25 friend bool operator==(const MoveOnlyInt& lhs, const MoveOnlyInt& rhs) { | 25 friend bool operator==(const MoveOnlyInt& lhs, const MoveOnlyInt& rhs) { |
26 return lhs.data_ == rhs.data_; | 26 return lhs.data_ == rhs.data_; |
27 } | 27 } |
28 | 28 |
29 friend bool operator!=(const MoveOnlyInt& lhs, const MoveOnlyInt& rhs) { | 29 friend bool operator!=(const MoveOnlyInt& lhs, const MoveOnlyInt& rhs) { |
30 return !operator==(lhs, rhs); | 30 return !operator==(lhs, rhs); |
31 } | 31 } |
32 | 32 |
| 33 friend bool operator<(const MoveOnlyInt& lhs, int rhs) { |
| 34 return lhs.data_ < rhs; |
| 35 } |
| 36 |
| 37 friend bool operator<(int lhs, const MoveOnlyInt& rhs) { |
| 38 return lhs < rhs.data_; |
| 39 } |
| 40 |
33 friend bool operator<(const MoveOnlyInt& lhs, const MoveOnlyInt& rhs) { | 41 friend bool operator<(const MoveOnlyInt& lhs, const MoveOnlyInt& rhs) { |
34 return lhs.data_ < rhs.data_; | 42 return lhs.data_ < rhs.data_; |
35 } | 43 } |
36 | 44 |
37 friend bool operator>(const MoveOnlyInt& lhs, const MoveOnlyInt& rhs) { | 45 friend bool operator>(const MoveOnlyInt& lhs, const MoveOnlyInt& rhs) { |
38 return rhs < lhs; | 46 return rhs < lhs; |
39 } | 47 } |
40 | 48 |
41 friend bool operator<=(const MoveOnlyInt& lhs, const MoveOnlyInt& rhs) { | 49 friend bool operator<=(const MoveOnlyInt& lhs, const MoveOnlyInt& rhs) { |
42 return !(rhs < lhs); | 50 return !(rhs < lhs); |
43 } | 51 } |
44 | 52 |
45 friend bool operator>=(const MoveOnlyInt& lhs, const MoveOnlyInt& rhs) { | 53 friend bool operator>=(const MoveOnlyInt& lhs, const MoveOnlyInt& rhs) { |
46 return !(lhs < rhs); | 54 return !(lhs < rhs); |
47 } | 55 } |
48 | 56 |
49 int data() const { return data_; } | 57 int data() const { return data_; } |
50 | 58 |
51 private: | 59 private: |
52 int data_; | 60 int data_; |
53 | 61 |
54 DISALLOW_COPY_AND_ASSIGN(MoveOnlyInt); | 62 DISALLOW_COPY_AND_ASSIGN(MoveOnlyInt); |
55 }; | 63 }; |
56 | 64 |
57 } // namespace base | 65 } // namespace base |
58 | 66 |
59 #endif // BASE_CONTAINERS_CONTAINER_TEST_UTILS_H_ | 67 #endif // BASE_CONTAINERS_CONTAINER_TEST_UTILS_H_ |
OLD | NEW |