|
25 | 25 | #include "test_allocator.h" |
26 | 26 | #include "test_macros.h" |
27 | 27 |
|
28 | | -struct NonCopyable { |
| 28 | +struct MoveOnly { |
29 | 29 | int i; |
30 | 30 |
|
31 | | - TEST_CONSTEXPR_CXX14 explicit NonCopyable(int i) : i(i) {} |
| 31 | + TEST_CONSTEXPR_CXX14 explicit MoveOnly(int i) : i(i) {} |
32 | 32 |
|
33 | | - NonCopyable(NonCopyable const&) = delete; |
34 | | - NonCopyable& operator=(NonCopyable const&) = delete; |
| 33 | + MoveOnly(MoveOnly const&) = delete; |
| 34 | + MoveOnly& operator=(MoveOnly const&) = delete; |
35 | 35 |
|
36 | | - TEST_CONSTEXPR_CXX14 NonCopyable(NonCopyable&& other) : i(other.i) { other.i = -1; } |
| 36 | + TEST_CONSTEXPR_CXX14 MoveOnly(MoveOnly&& other) noexcept : i(other.i) { other.i = -1; } |
37 | 37 |
|
38 | | - TEST_CONSTEXPR_CXX14 NonCopyable& operator=(NonCopyable&& other) { |
| 38 | + TEST_CONSTEXPR_CXX14 MoveOnly& operator=(MoveOnly&& other) noexcept { |
39 | 39 | i = other.i; |
40 | 40 | other.i = -1; |
41 | 41 | return *this; |
42 | 42 | } |
43 | 43 |
|
44 | | - TEST_CONSTEXPR_CXX14 friend bool operator==(NonCopyable const& lhs, NonCopyable const& rhs) { return lhs.i == rhs.i; } |
| 44 | + TEST_CONSTEXPR_CXX14 friend bool operator==(MoveOnly const& lhs, MoveOnly const& rhs) { return lhs.i == rhs.i; } |
45 | 45 | }; |
46 | 46 |
|
47 | 47 | template <class T> |
48 | 48 | struct has_moved_from_sentinel : std::false_type {}; |
49 | 49 |
|
50 | 50 | template <> |
51 | | -struct has_moved_from_sentinel<NonCopyable> : std::true_type {}; |
| 51 | +struct has_moved_from_sentinel<MoveOnly> : std::true_type {}; |
52 | 52 |
|
53 | 53 | template <template <class...> class Allocator, class T> |
54 | 54 | TEST_CONSTEXPR_CXX20 void test() { |
@@ -331,9 +331,9 @@ TEST_CONSTEXPR_CXX20 bool tests() { |
331 | 331 | test<min_allocator, int>(); |
332 | 332 | test<safe_allocator, int>(); |
333 | 333 |
|
334 | | - test<std::allocator, NonCopyable>(); |
335 | | - test<min_allocator, NonCopyable>(); |
336 | | - test<safe_allocator, NonCopyable>(); |
| 334 | + test<std::allocator, MoveOnly>(); |
| 335 | + test<min_allocator, MoveOnly>(); |
| 336 | + test<safe_allocator, MoveOnly>(); |
337 | 337 |
|
338 | 338 | test<std::allocator, NonTriviallyRelocatable>(); |
339 | 339 | test<min_allocator, NonTriviallyRelocatable>(); |
|
0 commit comments