Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test errors with _GLIBCXX_DEBUG defined #5693

Merged
merged 1 commit into from Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -482,7 +482,7 @@ void test_inplace_merge_etc(IteratorTag, DataType, int rand_base)
typedef typename std::vector<DataType>::iterator base_iterator;

std::size_t const left_size = 300007, right_size = 123456;
std::vector<DataType> res(left_size + right_size), sol, org;
std::vector<DataType> res(left_size + right_size), sol;

base_iterator res_first = std::begin(res);
base_iterator res_middle = res_first + left_size;
Expand All @@ -493,7 +493,7 @@ void test_inplace_merge_etc(IteratorTag, DataType, int rand_base)
std::sort(res_first, res_middle);
std::sort(res_middle, res_last);

org = sol = res;
sol = res;
base_iterator sol_first = std::begin(sol);
base_iterator sol_middle = sol_first + left_size;
base_iterator sol_last = std::end(sol);
Expand All @@ -502,8 +502,6 @@ void test_inplace_merge_etc(IteratorTag, DataType, int rand_base)
{
typedef test::test_iterator<base_iterator, IteratorTag> iterator;

sol = res = org;

hpx::inplace_merge(
iterator(res_first), iterator(res_middle), iterator(res_last));
std::inplace_merge(sol_first, sol_middle, sol_last);
Expand All @@ -524,7 +522,7 @@ void test_inplace_merge_etc(
typedef typename std::vector<DataType>::iterator base_iterator;

std::size_t const left_size = 300007, right_size = 123456;
std::vector<DataType> res(left_size + right_size), sol, org;
std::vector<DataType> res(left_size + right_size), sol;

base_iterator res_first = std::begin(res);
base_iterator res_middle = res_first + left_size;
Expand All @@ -535,7 +533,7 @@ void test_inplace_merge_etc(
std::sort(res_first, res_middle);
std::sort(res_middle, res_last);

org = sol = res;
sol = res;
base_iterator sol_first = std::begin(sol);
base_iterator sol_middle = sol_first + left_size;
base_iterator sol_last = std::end(sol);
Expand All @@ -544,8 +542,6 @@ void test_inplace_merge_etc(
{
typedef test::test_iterator<base_iterator, IteratorTag> iterator;

sol = res = org;

hpx::inplace_merge(policy, iterator(res_first), iterator(res_middle),
iterator(res_last));
std::inplace_merge(sol_first, sol_middle, sol_last);
Expand Down
Expand Up @@ -520,9 +520,9 @@ void test_is_heap(bool test_for_is_heap = true)
test_is_heap_with_pred(
seq, IteratorTag(), int(), std::greater<int>(), test_for_is_heap);
test_is_heap_with_pred(
par, IteratorTag(), int(), std::less<int>(), test_for_is_heap);
test_is_heap_with_pred(par_unseq, IteratorTag(), int(),
std::greater_equal<int>(), test_for_is_heap);
par, IteratorTag(), int(), std::greater<int>(), test_for_is_heap);
test_is_heap_with_pred(
par_unseq, IteratorTag(), int(), std::greater<int>(), test_for_is_heap);

test_is_heap_async(seq(task), IteratorTag(), int(), test_for_is_heap);
test_is_heap_async(par(task), IteratorTag(), int(), test_for_is_heap);
Expand Down
Expand Up @@ -546,13 +546,21 @@ namespace hpx { namespace traits {
} // namespace detail

template <typename Iter,
bool not_vector = !detail::is_vector_iterator<Iter>::value>
bool not_vector =
// When _GLIBCXX_DEBUG is defined vectors are contiguous, but the iterators
// are not plain pointers.
#if defined(_GLIBCXX_DEBUG)
false
#else
detail::is_vector_iterator<Iter>::value
#endif
>
struct is_contiguous_iterator : std::is_pointer<Iter>::type
{
};

template <typename Iter>
struct is_contiguous_iterator<Iter, false> : std::true_type
struct is_contiguous_iterator<Iter, true> : std::true_type
{
};

Expand Down