@@ -26,33 +26,43 @@ int main(int, char**) {
26
26
EXPECT_STD_TERMINATE ([&] {
27
27
try {
28
28
int a[] = {1 , 2 };
29
- (void )std::transform_reduce (
30
- policy,
31
- util::throw_on_move_iterator (std::begin (a), 1 ),
32
- util::throw_on_move_iterator (std::end (a), 1 ),
33
- util::throw_on_move_iterator (std::begin (a), 1 ),
34
- 1 );
29
+ util::throw_on_move_iterator first1 (std::begin (a), 1 );
30
+ util::throw_on_move_iterator last1 (std::end (a), 1 );
31
+ util::throw_on_move_iterator first2 (std::begin (a), 1 );
32
+ (void )std::transform_reduce (policy, std::move (first1), std::move (last1), std::move (first2), 1 );
35
33
} catch (const util::iterator_error&) {
36
34
assert (false );
37
35
}
38
36
std::terminate (); // make the test pass in case the algorithm didn't move the iterator
39
37
});
40
38
41
39
EXPECT_STD_TERMINATE ([&] {
42
- int a[2 ]{ };
40
+ int a[] = { 1 , 2 };
43
41
(void )std::transform_reduce (
44
42
policy, std::begin (a), std::end (a), 1 , [](int , int ) -> int { throw 1 ; }, [](int ) -> int { return 0 ; });
45
43
});
44
+
45
+ EXPECT_STD_TERMINATE ([&] {
46
+ try {
47
+ int a[] = {1 , 2 };
48
+ util::throw_on_move_iterator first1 (std::begin (a), 1 );
49
+ util::throw_on_move_iterator last1 (std::end (a), 1 );
50
+ (void )std::transform_reduce (policy, std::move (first1), std::move (last1), 1 , std::plus{}, [](int ) -> int {
51
+ return 0 ;
52
+ });
53
+ } catch (const util::iterator_error&) {
54
+ assert (false );
55
+ }
56
+ std::terminate (); // make the test pass in case the algorithm didn't move the iterator
57
+ });
58
+
46
59
EXPECT_STD_TERMINATE ([&] {
47
60
try {
48
61
int a[] = {1 , 2 };
49
- (void )std::transform_reduce (
50
- policy,
51
- util::throw_on_move_iterator (std::begin (a), 1 ),
52
- util::throw_on_move_iterator (std::end (a), 1 ),
53
- 1 ,
54
- std::plus{},
55
- [](int ) -> int { return 0 ; });
62
+ util::throw_on_move_iterator first1 (std::begin (a), 1 );
63
+ util::throw_on_move_iterator last1 (std::end (a), 1 );
64
+ util::throw_on_move_iterator first2 (std::begin (a), 1 );
65
+ (void )std::transform_reduce (policy, std::move (first1), std::move (last1), std::move (first2), 1 );
56
66
} catch (const util::iterator_error&) {
57
67
assert (false );
58
68
}
0 commit comments