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

Replace C++14 overload of std::equal with C++11 code. #3324

Merged
merged 1 commit into from May 22, 2018
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
18 changes: 5 additions & 13 deletions tests/unit/parallel/algorithms/inplace_merge_tests.hpp
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Taeguk Kwon
// Copyright (c) 2017-2018 Taeguk Kwon
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down Expand Up @@ -147,9 +147,7 @@ void test_inplace_merge(ExPolicy policy, IteratorTag, DataType, Comp comp,
sol_first, sol_middle, sol_last,
comp);

bool equality = std::equal(
res_first, res_last,
sol_first, sol_last);
bool equality = test::equal(res_first, res_last, sol_first, sol_last);

HPX_TEST(equality);
}
Expand Down Expand Up @@ -192,9 +190,7 @@ void test_inplace_merge_async(ExPolicy policy, IteratorTag, DataType, Comp comp,
sol_first, sol_middle, sol_last,
comp);

bool equality = std::equal(
res_first, res_last,
sol_first, sol_last);
bool equality = test::equal(res_first, res_last, sol_first, sol_last);

HPX_TEST(equality);
}
Expand Down Expand Up @@ -406,9 +402,7 @@ void test_inplace_merge_etc(ExPolicy policy, IteratorTag,
std::inplace_merge(
sol_first, sol_middle, sol_last);

bool equality = std::equal(
res_first, res_last,
sol_first, sol_last);
bool equality = test::equal(res_first, res_last, sol_first, sol_last);

HPX_TEST(equality);
}
Expand All @@ -432,9 +426,7 @@ void test_inplace_merge_etc(ExPolicy policy, IteratorTag,
});

// The container must not be changed.
bool equality = std::equal(
res_first, res_last,
sol_first, sol_last);
bool equality = test::equal(res_first, res_last, sol_first, sol_last);

HPX_TEST(equality);
#endif
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/parallel/algorithms/merge_tests.hpp
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Taeguk Kwon
// Copyright (c) 2017-2018 Taeguk Kwon
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down Expand Up @@ -142,7 +142,7 @@ void test_merge(ExPolicy policy, IteratorTag, DataType, Comp comp,
std::begin(dest_sol),
comp);

bool equality = std::equal(
bool equality = test::equal(
std::begin(dest_res), get<2>(result).base(),
std::begin(dest_sol), solution);

Expand Down Expand Up @@ -183,7 +183,7 @@ void test_merge_async(ExPolicy policy, IteratorTag, DataType, Comp comp,
std::begin(dest_sol),
comp);

bool equality = std::equal(
bool equality = test::equal(
std::begin(dest_res), get<2>(result).base(),
std::begin(dest_sol), solution);

Expand Down Expand Up @@ -383,7 +383,7 @@ void test_merge_etc(ExPolicy policy, IteratorTag,
std::begin(src2), std::end(src2),
std::begin(dest_sol));

bool equality = std::equal(
bool equality = test::equal(
std::begin(dest_res), get<2>(result).base(),
std::begin(dest_sol), solution);

Expand Down Expand Up @@ -445,7 +445,7 @@ void test_merge_etc(ExPolicy policy, IteratorTag,
std::begin(src2), std::end(src2),
std::begin(dest_sol));

bool equality = std::equal(
bool equality = test::equal(
std::begin(dest_res), get<2>(result).base(),
std::begin(dest_sol), solution);

Expand Down
10 changes: 5 additions & 5 deletions tests/unit/parallel/algorithms/partition_copy_tests.hpp
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Taeguk Kwon
// Copyright (c) 2017-2018 Taeguk Kwon
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down Expand Up @@ -120,10 +120,10 @@ void test_partition_copy(ExPolicy policy, IteratorTag, DataType, Pred pred,

HPX_TEST(get<0>(result).base() == std::end(c));

bool equality_true = std::equal(
bool equality_true = test::equal(
std::begin(d_true_res), get<1>(result).base(),
std::begin(d_true_sol), get<0>(solution));
bool equality_false = std::equal(
bool equality_false = test::equal(
std::begin(d_false_res), get<2>(result).base(),
std::begin(d_false_sol), get<1>(solution));

Expand Down Expand Up @@ -161,10 +161,10 @@ void test_partition_copy_async(ExPolicy policy, IteratorTag, DataType, Pred pred

HPX_TEST(get<0>(result).base() == std::end(c));

bool equality_true = std::equal(
bool equality_true = test::equal(
std::begin(d_true_res), get<1>(result).base(),
std::begin(d_true_sol), get<0>(solution));
bool equality_false = std::equal(
bool equality_false = test::equal(
std::begin(d_false_res), get<2>(result).base(),
std::begin(d_false_sol), get<1>(solution));

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/parallel/algorithms/partition_tests.hpp
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Taeguk Kwon
// Copyright (c) 2017-2018 Taeguk Kwon
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down Expand Up @@ -129,7 +129,7 @@ void test_partition(ExPolicy policy, IteratorTag, DataType, Pred pred,
std::sort(std::begin(c), std::end(c));
std::sort(std::begin(c_org), std::end(c_org));

bool unchanged = std::equal(
bool unchanged = test::equal(
std::begin(c), std::end(c),
std::begin(c_org), std::end(c_org));

Expand Down Expand Up @@ -169,7 +169,7 @@ void test_partition_async(ExPolicy policy, IteratorTag, DataType, Pred pred,
std::sort(std::begin(c), std::end(c));
std::sort(std::begin(c_org), std::end(c_org));

bool unchanged = std::equal(
bool unchanged = test::equal(
std::begin(c), std::end(c),
std::begin(c_org), std::end(c_org));

Expand Down
10 changes: 5 additions & 5 deletions tests/unit/parallel/algorithms/remove_tests.hpp
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Taeguk Kwon
// Copyright (c) 2017-2018 Taeguk Kwon
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down Expand Up @@ -127,7 +127,7 @@ void test_remove(ExPolicy policy, IteratorTag, DataType, ValueType value,
iterator(std::begin(c)), iterator(std::end(c)), value);
auto solution = std::remove(std::begin(d), std::end(d), value);

bool equality = std::equal(
bool equality = test::equal(
std::begin(c), result.base(),
std::begin(d), solution);

Expand Down Expand Up @@ -156,7 +156,7 @@ void test_remove_async(ExPolicy policy, IteratorTag, DataType, ValueType value,
auto result = f.get();
auto solution = std::remove(std::begin(d), std::end(d), value);

bool equality = std::equal(
bool equality = test::equal(
std::begin(c), result.base(),
std::begin(d), solution);

Expand Down Expand Up @@ -184,7 +184,7 @@ void test_remove_if(ExPolicy policy, IteratorTag, DataType, Pred pred,
iterator(std::begin(c)), iterator(std::end(c)), pred);
auto solution = std::remove_if(std::begin(d), std::end(d), pred);

bool equality = std::equal(
bool equality = test::equal(
std::begin(c), result.base(),
std::begin(d), solution);

Expand Down Expand Up @@ -212,7 +212,7 @@ void test_remove_if_async(ExPolicy policy, IteratorTag, DataType, Pred pred,
auto result = f.get();
auto solution = std::remove_if(std::begin(d), std::end(d), pred);

bool equality = std::equal(
bool equality = test::equal(
std::begin(c), result.base(),
std::begin(d), solution);

Expand Down
12 changes: 12 additions & 0 deletions tests/unit/parallel/algorithms/test_utils.hpp
@@ -1,4 +1,5 @@
// Copyright (c) 2014-2015 Hartmut Kaiser
// Copyright (c) 2018 Taeguk Kwon
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down Expand Up @@ -291,6 +292,17 @@ namespace test
}
return c;
}

///////////////////////////////////////////////////////////////////////////
template <typename InputIter1, typename InputIter2>
bool equal(InputIter1 first1, InputIter1 last1,
InputIter2 first2, InputIter2 last2)
{
if (std::distance(first1, last1) != std::distance(first2, last2))
return false;

return std::equal(first1, last1, first2);
}
}

#endif
10 changes: 5 additions & 5 deletions tests/unit/parallel/algorithms/unique_copy_tests.hpp
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Taeguk Kwon
// Copyright (c) 2017-2018 Taeguk Kwon
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down Expand Up @@ -132,7 +132,7 @@ void test_unique_copy(ExPolicy policy, IteratorTag, DataType, Pred pred,
std::begin(dest_sol),
pred);

bool equality = std::equal(
bool equality = test::equal(
std::begin(dest_res), get<1>(result).base(),
std::begin(dest_sol), solution);

Expand Down Expand Up @@ -165,7 +165,7 @@ void test_unique_copy_async(ExPolicy policy, IteratorTag, DataType, Pred pred,
std::begin(dest_sol),
pred);

bool equality = std::equal(
bool equality = test::equal(
std::begin(dest_res), get<1>(result).base(),
std::begin(dest_sol), solution);

Expand Down Expand Up @@ -337,7 +337,7 @@ void test_unique_copy_etc(ExPolicy policy, IteratorTag,
auto solution = std::unique_copy(std::begin(c), std::end(c),
std::begin(dest_sol));

bool equality = std::equal(
bool equality = test::equal(
std::begin(dest_res), get<1>(result).base(),
std::begin(dest_sol), solution);

Expand Down Expand Up @@ -384,7 +384,7 @@ void test_unique_copy_etc(ExPolicy policy, IteratorTag,
auto solution = std::unique_copy(std::begin(c), std::end(c),
std::begin(dest_sol));

bool equality = std::equal(
bool equality = test::equal(
std::begin(dest_res), get<1>(result).base(),
std::begin(dest_sol), solution);

Expand Down
10 changes: 5 additions & 5 deletions tests/unit/parallel/algorithms/unique_tests.hpp
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Taeguk Kwon
// Copyright (c) 2017-2018 Taeguk Kwon
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down Expand Up @@ -127,7 +127,7 @@ void test_unique(ExPolicy policy, IteratorTag, DataType, Pred pred,
iterator(std::begin(c)), iterator(std::end(c)), pred);
auto solution = std::unique(std::begin(d), std::end(d), pred);

bool equality = std::equal(
bool equality = test::equal(
std::begin(c), result.base(),
std::begin(d), solution);

Expand Down Expand Up @@ -155,7 +155,7 @@ void test_unique_async(ExPolicy policy, IteratorTag, DataType, Pred pred,
auto result = f.get();
auto solution = std::unique(std::begin(d), std::end(d), pred);

bool equality = std::equal(
bool equality = test::equal(
std::begin(c), result.base(),
std::begin(d), solution);

Expand Down Expand Up @@ -320,7 +320,7 @@ void test_unique_etc(ExPolicy policy, IteratorTag,
iterator(std::begin(c)), iterator(std::end(c)));
auto solution = std::unique(std::begin(d), std::end(d));

bool equality = std::equal(
bool equality = test::equal(
std::begin(c), result.base(),
std::begin(d), solution);

Expand Down Expand Up @@ -365,7 +365,7 @@ void test_unique_etc(ExPolicy policy, IteratorTag,
});
auto solution = std::unique(std::begin(d), std::end(d));

bool equality = std::equal(
bool equality = test::equal(
std::begin(c), result.base(),
std::begin(d), solution);

Expand Down
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Taeguk Kwon
// Copyright (c) 2017-2018 Taeguk Kwon
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down Expand Up @@ -116,7 +116,7 @@ void test_inplace_merge(ExPolicy policy, DataType)

HPX_TEST(result == res_last);

bool equality = std::equal(
bool equality = test::equal(
res_first, res_last,
sol_first, sol_last);

Expand Down Expand Up @@ -153,7 +153,7 @@ void test_inplace_merge_async(ExPolicy policy, DataType)

HPX_TEST(result == res_last);

bool equality = std::equal(
bool equality = test::equal(
res_first, res_last,
std::begin(sol), std::end(sol));

Expand Down
10 changes: 5 additions & 5 deletions tests/unit/parallel/container_algorithms/merge_range.cpp
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Taeguk Kwon
// Copyright (c) 2017-2018 Taeguk Kwon
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down Expand Up @@ -115,7 +115,7 @@ void test_merge(ExPolicy policy, DataType)
HPX_TEST(get<0>(result) == std::end(src1));
HPX_TEST(get<1>(result) == std::end(src2));

bool equality = std::equal(
bool equality = test::equal(
std::begin(dest_res), get<2>(result),
std::begin(dest_sol), solution);

Expand Down Expand Up @@ -151,7 +151,7 @@ void test_merge_async(ExPolicy policy, DataType)
HPX_TEST(get<0>(result) == std::end(src1));
HPX_TEST(get<1>(result) == std::end(src2));

bool equality = std::equal(
bool equality = test::equal(
std::begin(dest_res), get<2>(result),
std::begin(dest_sol), solution);

Expand Down Expand Up @@ -187,7 +187,7 @@ void test_merge_outiter(ExPolicy policy, DataType)
HPX_TEST(get<0>(result) == std::end(src1));
HPX_TEST(get<1>(result) == std::end(src2));

bool equality = std::equal(
bool equality = test::equal(
std::begin(dest_res), std::end(dest_res),
std::begin(dest_sol), std::end(dest_sol));

Expand Down Expand Up @@ -223,7 +223,7 @@ void test_merge_outiter_async(ExPolicy policy, DataType)
HPX_TEST(get<0>(result) == std::end(src1));
HPX_TEST(get<1>(result) == std::end(src2));

bool equality = std::equal(
bool equality = test::equal(
std::begin(dest_res), std::end(dest_res),
std::begin(dest_sol), std::end(dest_sol));

Expand Down