From 3b4edaa2fd6cab6684aabc3942642127df84ea92 Mon Sep 17 00:00:00 2001 From: targetakhil Date: Tue, 16 Nov 2021 10:56:30 +0530 Subject: [PATCH 1/3] remove std::pair and hpx::tuple specializations for algorithm_result_helper and local_algorithm_result --- .../parallel/algorithms/detail/dispatch.hpp | 24 ------- .../segmented_algorithms/detail/dispatch.hpp | 66 ------------------- 2 files changed, 90 deletions(-) diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/dispatch.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/dispatch.hpp index b26859874977..f12a751d5d80 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/dispatch.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/dispatch.hpp @@ -38,17 +38,6 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail { Result>::local_raw_iterator; }; - template - struct local_algorithm_result> - { - using type1 = typename hpx::traits::segmented_local_iterator_traits< - Result1>::local_raw_iterator; - using type2 = typename hpx::traits::segmented_local_iterator_traits< - Result2>::local_raw_iterator; - - using type = std::pair; - }; - template struct local_algorithm_result> { @@ -69,19 +58,6 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail { using type = util::min_max_result; }; - template - struct local_algorithm_result> - { - using type1 = typename hpx::traits::segmented_local_iterator_traits< - Result1>::local_raw_iterator; - using type2 = typename hpx::traits::segmented_local_iterator_traits< - Result2>::local_raw_iterator; - using type3 = typename hpx::traits::segmented_local_iterator_traits< - Result3>::local_raw_iterator; - - using type = hpx::tuple; - }; - template struct local_algorithm_result< util::in_in_out_result> diff --git a/libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/detail/dispatch.hpp b/libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/detail/dispatch.hpp index 113eaff5984c..a19697c77147 100644 --- a/libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/detail/dispatch.hpp +++ b/libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/detail/dispatch.hpp @@ -62,25 +62,6 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail { } }; - template - struct algorithm_result_helper, - std::enable_if_t< - hpx::traits::is_segmented_local_iterator_v || - hpx::traits::is_segmented_local_iterator_v>> - { - using traits1 = hpx::traits::segmented_local_iterator_traits; - using traits2 = hpx::traits::segmented_local_iterator_traits; - - HPX_FORCEINLINE static std::pair - call(std::pair&& p) - { - return std::make_pair(traits1::remote(HPX_MOVE(p.first)), - traits2::remote(HPX_MOVE(p.second))); - } - }; - template struct algorithm_result_helper, std::enable_if_t< @@ -118,29 +99,6 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail { } }; - template - struct algorithm_result_helper, - std::enable_if_t< - hpx::traits::is_segmented_local_iterator_v || - hpx::traits::is_segmented_local_iterator_v || - hpx::traits::is_segmented_local_iterator_v>> - { - using traits1 = hpx::traits::segmented_local_iterator_traits; - using traits2 = hpx::traits::segmented_local_iterator_traits; - using traits3 = hpx::traits::segmented_local_iterator_traits; - - HPX_FORCEINLINE static hpx::tuple - call(hpx::tuple&& p) - { - return hpx::make_tuple(traits1::remote(HPX_MOVE(hpx::get<0>(p))), - traits2::remote(HPX_MOVE(hpx::get<1>(p))), - traits3::remote(HPX_MOVE(hpx::get<2>(p)))); - } - }; - template struct algorithm_result_helper< util::in_in_out_result, @@ -185,30 +143,6 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail { } }; - template - struct algorithm_result_helper>, - std::enable_if_t< - hpx::traits::is_segmented_local_iterator_v || - hpx::traits::is_segmented_local_iterator_v>> - { - using traits1 = hpx::traits::segmented_local_iterator_traits; - using traits2 = hpx::traits::segmented_local_iterator_traits; - - using arg_type = std::pair; - using result_type = std::pair; - - HPX_FORCEINLINE static future call(future&& f) - { - return hpx::make_future( - HPX_MOVE(f), [](arg_type&& p) -> result_type { - return std::make_pair( - traits1::remote(p.first), traits2::remote(p.second)); - }); - } - }; - template struct algorithm_result_helper< future>, From 2ebe7b73a1f558ef7eed8b6808f42a82d8f1db9b Mon Sep 17 00:00:00 2001 From: targetakhil Date: Tue, 16 Nov 2021 20:32:24 +0530 Subject: [PATCH 2/3] remove tagged_pair, tagged and tagged_tuple --- libs/core/algorithms/CMakeLists.txt | 5 - .../parallel/algorithms/detail/dispatch.hpp | 2 +- .../parallel/algorithms/detail/transfer.hpp | 1 - .../include/hpx/parallel/algorithms/merge.hpp | 2 +- .../include/hpx/parallel/algorithms/move.hpp | 8 +- .../hpx/parallel/algorithms/partition.hpp | 73 +++-- .../hpx/parallel/algorithms/reduce_by_key.hpp | 2 +- .../hpx/parallel/algorithms/remove.hpp | 1 - .../hpx/parallel/algorithms/remove_copy.hpp | 1 - .../hpx/parallel/algorithms/reverse.hpp | 1 - .../hpx/parallel/algorithms/rotate.hpp | 1 - .../hpx/parallel/algorithms/shift_left.hpp | 1 - .../hpx/parallel/algorithms/shift_right.hpp | 1 - .../hpx/parallel/algorithms/sort_by_key.hpp | 15 +- .../algorithms/uninitialized_move.hpp | 1 - .../container_algorithms/partition.hpp | 30 +- .../container_algorithms/remove_copy.hpp | 1 - .../parallel/container_algorithms/replace.hpp | 1 - .../parallel/container_algorithms/unique.hpp | 1 - .../include/hpx/parallel/tagspec.hpp | 39 --- .../include/hpx/parallel/util/tagged_pair.hpp | 71 ----- .../hpx/parallel/util/tagged_tuple.hpp | 41 --- .../hpx/parallel/util/zip_iterator.hpp | 34 --- .../unit/algorithms/partition_copy_tests.hpp | 18 +- libs/core/datastructures/CMakeLists.txt | 4 - .../include/hpx/datastructures/tagged.hpp | 281 ------------------ .../hpx/datastructures/tagged_pair.hpp | 131 -------- .../hpx/datastructures/tagged_tuple.hpp | 112 ------- .../datastructures/tests/unit/CMakeLists.txt | 2 +- .../core/datastructures/tests/unit/tagged.cpp | 173 ----------- 30 files changed, 77 insertions(+), 977 deletions(-) delete mode 100644 libs/core/algorithms/include/hpx/parallel/tagspec.hpp delete mode 100644 libs/core/algorithms/include/hpx/parallel/util/tagged_pair.hpp delete mode 100644 libs/core/algorithms/include/hpx/parallel/util/tagged_tuple.hpp delete mode 100644 libs/core/datastructures/include/hpx/datastructures/tagged.hpp delete mode 100644 libs/core/datastructures/include/hpx/datastructures/tagged_pair.hpp delete mode 100644 libs/core/datastructures/include/hpx/datastructures/tagged_tuple.hpp delete mode 100644 libs/core/datastructures/tests/unit/tagged.cpp diff --git a/libs/core/algorithms/CMakeLists.txt b/libs/core/algorithms/CMakeLists.txt index 53f318237c1e..73d51aea2c3b 100644 --- a/libs/core/algorithms/CMakeLists.txt +++ b/libs/core/algorithms/CMakeLists.txt @@ -165,7 +165,6 @@ set(algorithms_headers hpx/parallel/memory.hpp hpx/parallel/numeric.hpp hpx/parallel/spmd_block.hpp - hpx/parallel/tagspec.hpp hpx/parallel/task_block.hpp hpx/parallel/task_group.hpp hpx/parallel/util/cancellation_token.hpp @@ -195,8 +194,6 @@ set(algorithms_headers hpx/parallel/util/ranges_facilities.hpp hpx/parallel/util/result_types.hpp hpx/parallel/util/scan_partitioner.hpp - hpx/parallel/util/tagged_pair.hpp - hpx/parallel/util/tagged_tuple.hpp hpx/parallel/util/transfer.hpp hpx/parallel/util/transform_loop.hpp hpx/parallel/util/zip_iterator.hpp @@ -210,8 +207,6 @@ set(algorithms_compat_headers hpx/traits/is_value_proxy.hpp => hpx/algorithms/traits/is_value_proxy.hpp hpx/traits/pointer_category.hpp => hpx/algorithms/traits/pointer_category.hpp hpx/traits/segmented_iterator_traits.hpp => hpx/algorithms/traits/segmented_iterator_traits.hpp - hpx/util/tagged_pair.hpp => hpx/datastructures/tagged_pair.hpp - hpx/util/tagged_tuple.hpp => hpx/datastructures/tagged_tuple.hpp ) # cmake-format: on diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/dispatch.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/dispatch.hpp index f12a751d5d80..2fee138d7a6e 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/dispatch.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/dispatch.hpp @@ -129,7 +129,7 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail { catch (...) { // this does not return - return hpx::parallel::detail::handle_exception::call(); } #endif diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/transfer.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/transfer.hpp index 948360fe59c5..d448593498dc 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/transfer.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/transfer.hpp @@ -11,7 +11,6 @@ #if !defined(HPX_COMPUTE_DEVICE_CODE) #include #endif -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/merge.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/merge.hpp index 85b190c13a31..270ed3b35c7b 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/merge.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/merge.hpp @@ -83,7 +83,7 @@ namespace hpx { /// if the execution policy is of type /// \a sequenced_task_policy or /// \a parallel_task_policy and returns - /// \a tagged_tuple otherwise. + /// \a RandIter3 otherwise. /// The \a merge algorithm returns the destination iterator to /// the end of the \a dest range. /// diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/move.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/move.hpp index 90009e5d5350..6e749c32ebf4 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/move.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/move.hpp @@ -52,14 +52,12 @@ namespace hpx { /// threads, and indeterminately sequenced within each thread. /// /// \returns The \a move algorithm returns a - /// \a hpx::future > + /// \a hpx::future> /// if the execution policy is of type /// \a sequenced_task_policy or /// \a parallel_task_policy and - /// returns \a tagged_pair - /// otherwise. - /// The \a move algorithm returns the pair of the input iterator - /// \a last and the output iterator to the + /// returns \a FwdIter2 otherwise. + /// The \a move algorithm returns the output iterator to the /// element in the destination range, one past the last element /// moved. /// diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/partition.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/partition.hpp index 9bbe776809a7..8234818401bb 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/partition.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/partition.hpp @@ -335,18 +335,15 @@ namespace hpx { /// calling thread. /// /// \returns The \a partition_copy algorithm returns - /// \a tagged_tuple. - /// The \a partition_copy algorithm returns the tuple of - /// the source iterator \a last, + /// \a std::pair. + /// The \a partition_copy algorithm returns the pair of /// the destination iterator to the end of the \a dest_true /// range, and the destination iterator to the end of the \a /// dest_false range. /// template - hpx::util::tagged_tuple + std::pair partition_copy(FwdIter1 first, FwdIter1 last, FwdIter2 dest_true, FwdIter3 dest_false, Pred&& pred, Proj&& proj); @@ -427,24 +424,18 @@ namespace hpx { /// within each thread. /// /// \returns The \a partition_copy algorithm returns a - /// \a hpx::future > + /// \a hpx::future> /// if the execution policy is of type \a parallel_task_policy /// and returns - /// \a tagged_tuple - /// otherwise. - /// The \a partition_copy algorithm returns the tuple of - /// the source iterator \a last, + /// \a std::pair otherwise. + /// The \a partition_copy algorithm returns the pair of /// the destination iterator to the end of the \a dest_true /// range, and the destination iterator to the end of the \a /// dest_false range. /// template - typename util::detail::algorithm_result>::type + util::detail::algorithm_result_t> partition_copy(ExPolicy&& policy, FwdIter1 first, FwdIter1 last, FwdIter2 dest_true, FwdIter3 dest_false, Pred&& pred, Proj&& proj); @@ -461,7 +452,6 @@ namespace hpx { #include #include #include -#include #include #include @@ -504,6 +494,31 @@ namespace hpx { #include namespace hpx { namespace parallel { inline namespace v1 { + + template + constexpr HPX_FORCEINLINE + std::pair::type, + typename hpx::tuple_element<2, Tuple>::type> + tuple_to_pair(Tuple&& t) + { + return std::make_pair(hpx::get<1>(t), hpx::get<2>(t)); + } + + template + hpx::future::type, + typename hpx::tuple_element<2, Tuple>::type>> + tuple_to_pair(hpx::future&& f) + { + using result_type = + std::pair::type, + typename hpx::tuple_element<2, Tuple>::type>; + + return lcos::make_future( + HPX_MOVE(f), [](Tuple&& t) -> result_type { + return tuple_to_pair(HPX_MOVE(t)); + }); + } + /////////////////////////////////////////////////////////////////////////// // stable_partition namespace detail { @@ -1657,9 +1672,7 @@ namespace hpx { namespace parallel { inline namespace v1 { traits::projected> )> // clang-format on - util::detail::algorithm_result_t> + util::detail::algorithm_result_t> partition_copy(ExPolicy&& policy, FwdIter1 first, FwdIter1 last, FwdIter2 dest_true, FwdIter3 dest_false, Pred&& pred, Proj&& proj = Proj()) @@ -1677,7 +1690,7 @@ namespace hpx { namespace parallel { inline namespace v1 { #endif using result_type = hpx::tuple; - return hpx::util::make_tagged_tuple( + return parallel::v1::tuple_to_pair( detail::partition_copy().call( HPX_FORWARD(ExPolicy, policy), first, last, dest_true, dest_false, HPX_FORWARD(Pred, pred), HPX_FORWARD(Proj, proj))); @@ -1815,11 +1828,9 @@ namespace hpx { parallel::traits::projected> )> // clang-format on - friend hpx::util::tagged_tuple - tag_fallback_invoke(hpx::partition_copy_t, FwdIter1 first, - FwdIter1 last, FwdIter2 dest_true, FwdIter3 dest_false, Pred&& pred, + friend std::pair tag_fallback_invoke( + hpx::partition_copy_t, FwdIter1 first, FwdIter1 last, + FwdIter2 dest_true, FwdIter3 dest_false, Pred&& pred, Proj&& proj = Proj()) { static_assert((hpx::traits::is_forward_iterator_v), @@ -1831,8 +1842,7 @@ namespace hpx { using result_type = hpx::tuple; - return hpx::util::make_tagged_tuple( + return parallel::v1::tuple_to_pair( parallel::v1::detail::partition_copy().call( hpx::execution::seq, first, last, dest_true, dest_false, HPX_FORWARD(Pred, pred), HPX_FORWARD(Proj, proj))); @@ -1853,9 +1863,7 @@ namespace hpx { )> // clang-format on friend parallel::util::detail::algorithm_result_t> + std::pair> tag_fallback_invoke(hpx::partition_copy_t, ExPolicy&& policy, FwdIter1 first, FwdIter1 last, FwdIter2 dest_true, FwdIter3 dest_false, Pred&& pred, Proj&& proj = Proj()) @@ -1869,8 +1877,7 @@ namespace hpx { using result_type = hpx::tuple; - return hpx::util::make_tagged_tuple( + return parallel::v1::tuple_to_pair( parallel::v1::detail::partition_copy().call( HPX_FORWARD(ExPolicy, policy), first, last, dest_true, dest_false, HPX_FORWARD(Pred, pred), diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/reduce_by_key.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/reduce_by_key.hpp index f14ee2c338bd..6ad9f8f30187 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/reduce_by_key.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/reduce_by_key.hpp @@ -171,7 +171,7 @@ namespace hpx { namespace parallel { inline namespace v1 { util::in_out_result make_pair_result( ZIter zipiter, iKey key_start, iVal val_start) { - // the iterator we want is 'second' part of tagged_pair type (from copy_if) + // the iterator we want is 'second' part of pair type (from copy_if) auto t = zipiter.out.get_iterator_tuple(); iKey key_end = hpx::get<0>(t); return util::in_out_result{key_end, diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/remove.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/remove.hpp index 55deb6a388b8..55333834f18d 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/remove.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/remove.hpp @@ -213,7 +213,6 @@ namespace hpx { #include #include #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/remove_copy.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/remove_copy.hpp index 25429741fc8b..ab7418001924 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/remove_copy.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/remove_copy.hpp @@ -256,7 +256,6 @@ namespace hpx { #include #include #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/reverse.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/reverse.hpp index d39708eac4ea..1ff15ea164da 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/reverse.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/reverse.hpp @@ -182,7 +182,6 @@ namespace hpx { #include #include #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp index afc410bfc628..730b3389f10f 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp @@ -185,7 +185,6 @@ namespace hpx { #include #include #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/shift_left.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/shift_left.hpp index 0d447d720121..a15f2d7eb9d9 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/shift_left.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/shift_left.hpp @@ -111,7 +111,6 @@ namespace hpx { #include #include #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/shift_right.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/shift_right.hpp index f84203f8383e..cf9a6fe4e09c 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/shift_right.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/shift_right.hpp @@ -110,7 +110,6 @@ namespace hpx { #include #include #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/sort_by_key.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/sort_by_key.hpp index 890da135c3df..96b28b52a9fd 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/sort_by_key.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/sort_by_key.hpp @@ -9,7 +9,6 @@ #include #include -#include #include #include @@ -100,11 +99,11 @@ namespace hpx { namespace parallel { inline namespace v1 { /// threads, and indeterminately sequenced within each thread. /// /// \returns The \a sort_by-key algorithm returns a - /// \a hpx::future, tag::in2(ValueIter)> > + /// \a hpx::future> /// if the execution policy is of type /// \a sequenced_task_policy or /// \a parallel_task_policy and returns \a - /// \a tagged_pair + /// \a std::pair /// otherwise. /// The algorithm returns a pair holding an iterator pointing to /// the first element after the last element in the input key @@ -114,8 +113,7 @@ namespace hpx { namespace parallel { inline namespace v1 { template - typename util::detail::algorithm_result>::type + util::detail::algorithm_result_t> sort_by_key(ExPolicy&& policy, KeyIter key_first, KeyIter key_last, ValueIter value_first, Compare&& comp = Compare()) { @@ -124,10 +122,9 @@ namespace hpx { namespace parallel { inline namespace v1 { "sort_by_key is not supported unless HPX_HAVE_TUPLE_RVALUE_SWAP " "is defined"); #else - static_assert((hpx::traits::is_random_access_iterator::value), + static_assert((hpx::traits::is_random_access_iterator_v), "Requires a random access iterator."); - static_assert( - (hpx::traits::is_random_access_iterator::value), + static_assert((hpx::traits::is_random_access_iterator_v), "Requires a random access iterator."); ValueIter value_last = value_first; @@ -135,7 +132,7 @@ namespace hpx { namespace parallel { inline namespace v1 { using iterator_type = hpx::util::zip_iterator; - return detail::get_iter_tagged_pair( + return detail::get_iter_pair( detail::sort().call(HPX_FORWARD(ExPolicy, policy), hpx::util::make_zip_iterator(key_first, value_first), hpx::util::make_zip_iterator(key_last, value_last), diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/uninitialized_move.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/uninitialized_move.hpp index a48cbecec32d..242362069ada 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/uninitialized_move.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/uninitialized_move.hpp @@ -198,7 +198,6 @@ namespace hpx { #include #include #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/container_algorithms/partition.hpp b/libs/core/algorithms/include/hpx/parallel/container_algorithms/partition.hpp index 4e8152dbad0c..eb84098f4471 100644 --- a/libs/core/algorithms/include/hpx/parallel/container_algorithms/partition.hpp +++ b/libs/core/algorithms/include/hpx/parallel/container_algorithms/partition.hpp @@ -616,8 +616,7 @@ namespace hpx { /// template - hpx::util::tagged_tuple + hpx::util::in_out_out partition_copy(FwdIter1 first, Sent last, FwdIter2 dest_true, FwdIter3 dest_false, Pred&& pred, Proj&& proj); @@ -906,7 +905,6 @@ namespace hpx { #include #include #include -#include #include #include @@ -962,20 +960,28 @@ namespace hpx { namespace parallel { inline namespace v1 { )> // clang-format on HPX_DEPRECATED_V(1, 8, - "hpx::parallel::partition_copy is deprecated, use hpx::partition_copy " - "instead") typename util::detail::algorithm_result), - tag::out1(FwdIter2), tag::out2(FwdIter3)>>::type - partition_copy(ExPolicy&& policy, Rng&& rng, FwdIter2 dest_true, - FwdIter3 dest_false, Pred&& pred, Proj&& proj = Proj()) + "hpx::parallel::partition_copy is deprecated, use " + "hpx::partition_copy " + "instead") util::detail::algorithm_result_t, + FwdIter2, FwdIter3>> partition_copy(ExPolicy&& policy, Rng&& rng, + FwdIter2 dest_true, FwdIter3 dest_false, Pred&& pred, + Proj&& proj = Proj()) { + using iterator = hpx::traits::range_iterator_t; + using result_type = hpx::tuple; + + static_assert(hpx::traits::is_forward_iterator_v, + "Requires at least forward iterator."); + #if defined(HPX_GCC_VERSION) && HPX_GCC_VERSION >= 100000 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif - return partition_copy(HPX_FORWARD(ExPolicy, policy), - hpx::util::begin(rng), hpx::util::end(rng), dest_true, dest_false, - HPX_FORWARD(Pred, pred), HPX_FORWARD(Proj, proj)); + return parallel::util::make_in_out_out_result( + partition_copy(HPX_FORWARD(ExPolicy, policy), hpx::util::begin(rng), + hpx::util::end(rng), dest_true, dest_false, + HPX_FORWARD(Pred, pred), HPX_FORWARD(Proj, proj))); #if defined(HPX_GCC_VERSION) && HPX_GCC_VERSION >= 100000 #pragma GCC diagnostic pop #endif diff --git a/libs/core/algorithms/include/hpx/parallel/container_algorithms/remove_copy.hpp b/libs/core/algorithms/include/hpx/parallel/container_algorithms/remove_copy.hpp index 000b51401be6..55105b3b74ae 100644 --- a/libs/core/algorithms/include/hpx/parallel/container_algorithms/remove_copy.hpp +++ b/libs/core/algorithms/include/hpx/parallel/container_algorithms/remove_copy.hpp @@ -577,7 +577,6 @@ namespace hpx { namespace ranges { #include #include #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/container_algorithms/replace.hpp b/libs/core/algorithms/include/hpx/parallel/container_algorithms/replace.hpp index 7974971e8448..8157b7162339 100644 --- a/libs/core/algorithms/include/hpx/parallel/container_algorithms/replace.hpp +++ b/libs/core/algorithms/include/hpx/parallel/container_algorithms/replace.hpp @@ -1072,7 +1072,6 @@ namespace hpx { namespace ranges { #include #include #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/container_algorithms/unique.hpp b/libs/core/algorithms/include/hpx/parallel/container_algorithms/unique.hpp index ffe893e43606..ccc0578cd0d8 100644 --- a/libs/core/algorithms/include/hpx/parallel/container_algorithms/unique.hpp +++ b/libs/core/algorithms/include/hpx/parallel/container_algorithms/unique.hpp @@ -594,7 +594,6 @@ namespace hpx { namespace ranges { #include #include #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/tagspec.hpp b/libs/core/algorithms/include/hpx/parallel/tagspec.hpp deleted file mode 100644 index 91edfdb5890a..000000000000 --- a/libs/core/algorithms/include/hpx/parallel/tagspec.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2015-2016 Hartmut Kaiser -// Copyright (c) 2017 Taeguk Kwon -// -// SPDX-License-Identifier: BSL-1.0 -// 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) - -// make inspect happy: hpxinspect:nominmax - -#pragma once - -#include -#include - -namespace hpx { namespace parallel { inline namespace v1 { - HPX_DEFINE_TAG_SPECIFIER(in) // defines tag::in - HPX_DEFINE_TAG_SPECIFIER(out) // defines tag::out - HPX_DEFINE_TAG_SPECIFIER(begin) // defines tag::begin - HPX_DEFINE_TAG_SPECIFIER(end) // defines tag::end - HPX_DEFINE_TAG_SPECIFIER(in1) // defines tag::in1 - HPX_DEFINE_TAG_SPECIFIER(in2) // defines tag::in2 - HPX_DEFINE_TAG_SPECIFIER(out1) // defines tag::out1 - HPX_DEFINE_TAG_SPECIFIER(out2) // defines tag::out2 - -#if defined(HPX_MSVC) -#pragma push_macro("min") -#pragma push_macro("max") -#undef min -#undef max -#endif - - HPX_DEFINE_TAG_SPECIFIER(min) // defines tag::min - HPX_DEFINE_TAG_SPECIFIER(max) // defines tag::max - -#if defined(HPX_MSVC) -#pragma pop_macro("min") -#pragma pop_macro("max") -#endif -}}} // namespace hpx::parallel::v1 diff --git a/libs/core/algorithms/include/hpx/parallel/util/tagged_pair.hpp b/libs/core/algorithms/include/hpx/parallel/util/tagged_pair.hpp deleted file mode 100644 index 900688ab1bf7..000000000000 --- a/libs/core/algorithms/include/hpx/parallel/util/tagged_pair.hpp +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright Eric Niebler 2013-2015 -// Copyright 2015-2020 Hartmut Kaiser -// -// SPDX-License-Identifier: BSL-1.0 -// 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) -// -// This was modeled after the code available in the Range v3 library - -#pragma once - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace hpx { namespace util { - /////////////////////////////////////////////////////////////////////////// - template - hpx::future::type), - Tag2(typename std::decay::type)>> - make_tagged_pair(hpx::future>&& f) - { - typedef hpx::util::tagged_pair::type), - Tag2(typename std::decay::type)> - result_type; - -#if defined(HPX_COMPUTE_DEVICE_CODE) - HPX_UNUSED(f); - HPX_ASSERT(false); - return hpx::future(); -#else - return lcos::make_future( - HPX_MOVE(f), [](std::pair&& p) -> result_type { - return make_tagged_pair(HPX_MOVE(p)); - }); -#endif - } - - template - hpx::future>::type), - Tag2(typename hpx::tuple_element<1, hpx::tuple>::type)>> - make_tagged_pair(hpx::future>&& f) - { - static_assert( - sizeof...(Ts) >= 2, "tuple must have at least 2 elements"); - - typedef hpx::util::tagged_pair< - Tag1(typename hpx::tuple_element<0, hpx::tuple>::type), - Tag2(typename hpx::tuple_element<1, hpx::tuple>::type)> - result_type; - -#if defined(HPX_COMPUTE_DEVICE_CODE) - HPX_UNUSED(f); - HPX_ASSERT(false); - return hpx::future(); -#else - return lcos::make_future( - HPX_MOVE(f), [](hpx::tuple&& p) -> result_type { - return make_tagged_pair(HPX_MOVE(p)); - }); -#endif - } -}} // namespace hpx::util diff --git a/libs/core/algorithms/include/hpx/parallel/util/tagged_tuple.hpp b/libs/core/algorithms/include/hpx/parallel/util/tagged_tuple.hpp deleted file mode 100644 index 6295b1da77df..000000000000 --- a/libs/core/algorithms/include/hpx/parallel/util/tagged_tuple.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Eric Niebler 2013-2015 -// Copyright 2015-2020 Hartmut Kaiser -// -// SPDX-License-Identifier: BSL-1.0 -// 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) -// -// This was modeled after the code available in the Range v3 library - -#pragma once - -#include -#include -#include -#include -#include - -#include -#include - -namespace hpx { namespace util { - template - hpx::future, - typename util::make_index_pack::type, Tags...>::type> - make_tagged_tuple(hpx::future>&& f) - { - static_assert( - sizeof...(Tags) == hpx::tuple_size>::value, - "the number of tags must be identical to the size of the given " - "tuple"); - - typedef typename detail::tagged_tuple_helper, - typename util::make_index_pack::type, - Tags...>::type result_type; - - return lcos::make_future( - HPX_MOVE(f), [](hpx::tuple&& t) -> result_type { - return make_tagged_tuple(HPX_MOVE(t)); - }); - } -}} // namespace hpx::util diff --git a/libs/core/algorithms/include/hpx/parallel/util/zip_iterator.hpp b/libs/core/algorithms/include/hpx/parallel/util/zip_iterator.hpp index c4303e4f4bd4..14205cb176a6 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/zip_iterator.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/zip_iterator.hpp @@ -13,7 +13,6 @@ #include #include #include -#include #include @@ -85,39 +84,6 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail { [](ZipIter zipiter) { return get_iter_pair(HPX_MOVE(zipiter)); }); } - /////////////////////////////////////////////////////////////////////////// - template - hpx::util::tagged_pair::type), - Tag2(typename hpx::tuple_element<1, - typename ZipIter::iterator_tuple_type>::type)> - get_iter_tagged_pair(ZipIter&& zipiter) - { - return hpx::util::make_tagged_pair( - zipiter.get_iterator_tuple()); - } - - template - hpx::future::type), - Tag2(typename hpx::tuple_element<1, - typename ZipIter::iterator_tuple_type>::type)>> - get_iter_tagged_pair(hpx::future&& zipiter) - { - typedef typename ZipIter::iterator_tuple_type iterator_tuple_type; - - typedef hpx::util::tagged_pair< - Tag1(typename hpx::tuple_element<0, iterator_tuple_type>::type), - Tag2(typename hpx::tuple_element<1, iterator_tuple_type>::type)> - result_type; - - return lcos::make_future( - HPX_MOVE(zipiter), [](ZipIter&& zipiter) { - return get_iter_tagged_pair(HPX_MOVE(zipiter)); - }); - } - /////////////////////////////////////////////////////////////////////////// template util::in_in_result(result).base() == std::end(c)); - bool equality_true = test::equal(std::begin(d_true_res), - get<1>(result).base(), std::begin(d_true_sol), get<0>(solution)); + result.first.base(), std::begin(d_true_sol), solution.first); bool equality_false = test::equal(std::begin(d_false_res), - get<2>(result).base(), std::begin(d_false_sol), get<1>(solution)); + result.second.base(), std::begin(d_false_sol), solution.second); HPX_TEST(equality_true); HPX_TEST(equality_false); @@ -152,12 +150,10 @@ void test_partition_copy( auto solution = std::partition_copy(std::begin(c), std::end(c), std::begin(d_true_sol), std::begin(d_false_sol), pred); - HPX_TEST(get<0>(result).base() == std::end(c)); - bool equality_true = test::equal(std::begin(d_true_res), - get<1>(result).base(), std::begin(d_true_sol), get<0>(solution)); + result.first.base(), std::begin(d_true_sol), solution.first); bool equality_false = test::equal(std::begin(d_false_res), - get<2>(result).base(), std::begin(d_false_sol), get<1>(solution)); + result.second.base(), std::begin(d_false_sol), solution.second); HPX_TEST(equality_true); HPX_TEST(equality_false); @@ -189,12 +185,10 @@ void test_partition_copy_async( auto solution = std::partition_copy(std::begin(c), std::end(c), std::begin(d_true_sol), std::begin(d_false_sol), pred); - HPX_TEST(get<0>(result).base() == std::end(c)); - bool equality_true = test::equal(std::begin(d_true_res), - get<1>(result).base(), std::begin(d_true_sol), get<0>(solution)); + result.first.base(), std::begin(d_true_sol), solution.first); bool equality_false = test::equal(std::begin(d_false_res), - get<2>(result).base(), std::begin(d_false_sol), get<1>(solution)); + result.second.base(), std::begin(d_false_sol), solution.second); HPX_TEST(equality_true); HPX_TEST(equality_false); diff --git a/libs/core/datastructures/CMakeLists.txt b/libs/core/datastructures/CMakeLists.txt index e703d6c722bd..6539bacdb356 100644 --- a/libs/core/datastructures/CMakeLists.txt +++ b/libs/core/datastructures/CMakeLists.txt @@ -26,9 +26,6 @@ set(datastructures_headers hpx/datastructures/member_pack.hpp hpx/datastructures/optional.hpp hpx/datastructures/tuple.hpp - hpx/datastructures/tagged.hpp - hpx/datastructures/tagged_pair.hpp - hpx/datastructures/tagged_tuple.hpp hpx/datastructures/traits/supports_streaming_with_any.hpp hpx/datastructures/traits/is_tuple_like.hpp hpx/datastructures/variant.hpp @@ -42,7 +39,6 @@ set(datastructures_compat_headers hpx/traits/is_tuple_like.hpp => hpx/modules/datastructures.hpp hpx/util/any.hpp => hpx/any.hpp hpx/util/optional.hpp => hpx/optional.hpp - hpx/util/tagged.hpp => hpx/modules/datastructures.hpp hpx/util/tuple.hpp => hpx/tuple.hpp ) # cmake-format: on diff --git a/libs/core/datastructures/include/hpx/datastructures/tagged.hpp b/libs/core/datastructures/include/hpx/datastructures/tagged.hpp deleted file mode 100644 index 6e36e6fb35ed..000000000000 --- a/libs/core/datastructures/include/hpx/datastructures/tagged.hpp +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright Eric Niebler 2013-2015 -// Copyright 2015-2020 Hartmut Kaiser -// -// SPDX-License-Identifier: BSL-1.0 -// 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) -// -// This was modeled after the code available in the Range v3 library - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace hpx { namespace util { - template - struct tagged; - - namespace tag { - struct specifier_tag - { - }; - } // namespace tag - - /// \cond - namespace detail { - /////////////////////////////////////////////////////////////////////// - struct getters - { - private: - template - friend struct util::tagged; - - template - struct unpack_getter - { - typedef typename Tag::template getter::type, I> - type; - - private: - template - friend struct util::tagged; - }; - - template - struct collect_; - - template - struct collect_, Tags...> - : unpack_getter::type... - { - }; - - public: - template - struct collect - : collect_::type, - Tags...> - { - }; - }; - - /////////////////////////////////////////////////////////////////////// - template - struct tag_spec; - - template - struct tag_spec - { - typedef Spec type; - }; - - template - struct tag_elem; - - template - struct tag_elem - { - typedef Elem type; - }; - } // namespace detail - /// \endcond - - template - struct tagged - : Base - , detail::getters::collect, Tags...> - { - // specified as: - // - // using Base::Base; - // tagged() = default; - // tagged(tagged&&) = default; - // tagged(const tagged&) = default; - // tagged &operator=(tagged&&) = default; - // tagged &operator=(const tagged&) = default; - - template - tagged(Ts&&... ts) - : Base(HPX_FORWARD(Ts, ts)...) - { - } - - // Effects: Initializes Base with static_cast(rhs). - // Returns: *this. - template ::value)> - tagged(tagged&& rhs) noexcept - : Base(static_cast(rhs)) - { - } - - // Effects: Initializes Base with static_cast(rhs). - // Returns: *this. - template ::value)> - tagged(tagged const& rhs) - : Base(static_cast(rhs)) - { - } - - // Effects: Assigns static_cast(rhs) to - // static_cast(*this). - // Returns: *this. - template ::value)> - tagged& operator=(tagged&& rhs) - { - static_cast(*this) = static_cast(rhs); - return *this; - } - - // Effects: Assigns static_cast(rhs) to - // static_cast(*this). - // Returns: *this. - template ::value)> - tagged& operator=(tagged const& rhs) - { - static_cast(*this) = static_cast(rhs); - return *this; - } - - // Effects: Assigns HPX_FORWARD(U, u) to static_cast(*this). - // Returns: *this. - template ::type>::value && - std::is_convertible::value)> - tagged& operator=(U&& u) - { - static_cast(*this) = HPX_FORWARD(U, u); - return *this; - } - - // Effects: Calls swap on the result of applying static_cast to *this - // and other. - // Throws: Nothing unless the call to swap on the Base sub-objects - // throws. - HPX_FORCEINLINE void swap(tagged& other) noexcept - { - std::swap(static_cast(*this), static_cast(other)); - } - - // Effects: x.swap(y). - // Throws: Nothing unless the call to x.swap(y) throws. - friend HPX_FORCEINLINE void swap(tagged& x, tagged& y) noexcept - { - x.swap(y); - } - }; -}} // namespace hpx::util - -namespace hpx { - /////////////////////////////////////////////////////////////////////////// - template - struct tuple_size> : tuple_size - { - }; - - template - struct tuple_element> - : tuple_element - { - }; -} // namespace hpx - -// A tagged getter is an empty trivial class type that has a named member -// function that returns a reference to a member of a tuple-like object that is -// assumed to be derived from the getter class. The tuple-like type of a tagged -// getter is called its DerivedCharacteristic. The index of the tuple element -// returned from the getter's member functions is called its ElementIndex. The -// name of the getter's member function is called its ElementName. - -// A tagged getter class with DerivedCharacteristic D, ElementIndex N, and -// ElementName name shall provide the following interface: -// -// struct __TAGGED_GETTER -// { -// constexpr decltype(auto) -// name() & { return get(static_cast(*this)); } -// constexpr decltype(auto) -// name() && { return get(static_cast(*this)); } -// constexpr decltype(auto) -// name() const & { return get(static_cast(*this)); } -// }; - -#define HPX_DEFINE_TAG_SPECIFIER(NAME) \ - namespace tag { \ - struct NAME : hpx::util::tag::specifier_tag \ - { \ - private: \ - friend struct hpx::util::detail::getters; \ - \ - template \ - struct getter \ - { \ - HPX_FORCEINLINE Type& NAME() \ - { \ - return hpx::get(static_cast(*this)); \ - } \ - constexpr HPX_FORCEINLINE Type const& NAME() const \ - { \ - return hpx::get(static_cast(*this)); \ - } \ - \ - private: \ - friend struct hpx::util::detail::getters; \ - }; \ - }; \ - } \ -/**/ - -/////////////////////////////////////////////////////////////////////////////// -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunknown-pragmas" -#pragma clang diagnostic ignored "-Wpragmas" -#pragma clang diagnostic ignored "-Wmismatched-tags" -#endif - -#if defined(__GNUG__) && !defined(__INTEL_COMPILER) -#if defined(HPX_GCC_DIAGNOSTIC_PRAGMA_CONTEXTS) -#pragma GCC diagnostic push -#endif -#pragma GCC diagnostic ignored "-Wunknown-pragmas" -#pragma GCC diagnostic ignored "-Wpragmas" -#pragma GCC diagnostic ignored "-Wmismatched-tags" -#endif - -namespace std { - template - struct tuple_size> : tuple_size - { - }; - - template - struct tuple_element> - : tuple_element - { - }; -} // namespace std - -#if defined(__GNUG__) && !defined(__INTEL_COMPILER) -#if defined(HPX_GCC_DIAGNOSTIC_PRAGMA_CONTEXTS) -#pragma GCC diagnostic pop -#endif -#endif - -#if defined(__clang__) -#pragma clang diagnostic pop -#endif diff --git a/libs/core/datastructures/include/hpx/datastructures/tagged_pair.hpp b/libs/core/datastructures/include/hpx/datastructures/tagged_pair.hpp deleted file mode 100644 index 656fba6eefe6..000000000000 --- a/libs/core/datastructures/include/hpx/datastructures/tagged_pair.hpp +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright Eric Niebler 2013-2015 -// Copyright 2015-2020 Hartmut Kaiser -// -// SPDX-License-Identifier: BSL-1.0 -// 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) -// -// This was modeled after the code available in the Range v3 library - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include - -namespace hpx { namespace util { - /////////////////////////////////////////////////////////////////////////// - template - struct tagged_pair - : tagged::type, - typename detail::tag_elem::type>, - typename detail::tag_spec::type, - typename detail::tag_spec::type> - { - typedef tagged::type, - typename detail::tag_elem::type>, - typename detail::tag_spec::type, - typename detail::tag_spec::type> - base_type; - - template - tagged_pair(Ts&&... ts) - : base_type(HPX_FORWARD(Ts, ts)...) - { - } - }; - - /////////////////////////////////////////////////////////////////////////// - template - constexpr HPX_FORCEINLINE tagged_pair::type), - Tag2(typename std::decay::type)> - make_tagged_pair(std::pair&& p) - { - typedef tagged_pair::type), - Tag2(typename std::decay::type)> - result_type; - - return result_type(HPX_MOVE(p)); - } - - template - constexpr HPX_FORCEINLINE tagged_pair::type), - Tag2(typename std::decay::type)> - make_tagged_pair(std::pair const& p) - { - typedef tagged_pair::type), - Tag2(typename std::decay::type)> - result_type; - - return result_type(p); - } - - template - constexpr HPX_FORCEINLINE tagged_pair< - Tag1(typename hpx::tuple_element<0, hpx::tuple>::type), - Tag2(typename hpx::tuple_element<1, hpx::tuple>::type)> - make_tagged_pair(hpx::tuple&& p) - { - static_assert( - sizeof...(Ts) >= 2, "hpx::tuple must have at least 2 elements"); - - typedef tagged_pair< - Tag1(typename hpx::tuple_element<0, hpx::tuple>::type), - Tag2(typename hpx::tuple_element<1, hpx::tuple>::type)> - result_type; - - return result_type(HPX_MOVE(get<0>(p)), HPX_MOVE(get<1>(p))); - } - - template - constexpr HPX_FORCEINLINE tagged_pair< - Tag1(typename hpx::tuple_element<0, hpx::tuple>::type), - Tag2(typename hpx::tuple_element<1, hpx::tuple>::type)> - make_tagged_pair(hpx::tuple const& p) - { - static_assert( - sizeof...(Ts) >= 2, "hpx::tuple must have at least 2 elements"); - - typedef tagged_pair< - Tag1(typename hpx::tuple_element<0, hpx::tuple>::type), - Tag2(typename hpx::tuple_element<1, hpx::tuple>::type)> - result_type; - - return result_type(get<0>(p), get<1>(p)); - } - - /////////////////////////////////////////////////////////////////////////// - template - constexpr HPX_FORCEINLINE tagged_pair::type), - Tag2(typename std::decay::type)> - make_tagged_pair(T1&& t1, T2&& t2) - { - typedef tagged_pair::type), - Tag2(typename std::decay::type)> - result_type; - - return result_type(HPX_FORWARD(T1, t1), HPX_FORWARD(T2, t2)); - } -}} // namespace hpx::util - -namespace hpx { - /////////////////////////////////////////////////////////////////////////// - template - struct tuple_size> - : std::integral_constant - { - }; - - template - struct tuple_element> - : hpx::tuple_element::type, - typename util::detail::tag_elem::type>> - { - }; -} // namespace hpx diff --git a/libs/core/datastructures/include/hpx/datastructures/tagged_tuple.hpp b/libs/core/datastructures/include/hpx/datastructures/tagged_tuple.hpp deleted file mode 100644 index 677665fdc576..000000000000 --- a/libs/core/datastructures/include/hpx/datastructures/tagged_tuple.hpp +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright Eric Niebler 2013-2015 -// Copyright 2015-2020 Hartmut Kaiser -// -// SPDX-License-Identifier: BSL-1.0 -// 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) -// -// This was modeled after the code available in the Range v3 library - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include - -namespace hpx { namespace util { - /////////////////////////////////////////////////////////////////////////// - template - struct tagged_tuple - : tagged::type...>, - typename detail::tag_spec::type...> - { - using base_type = - tagged::type...>, - typename detail::tag_spec::type...>; - - template - tagged_tuple(Ts_&&... ts) - : base_type(HPX_FORWARD(Ts_, ts)...) - { - } - }; - - /////////////////////////////////////////////////////////////////////////// - namespace detail { - template - struct tagged_type - { - using decayed_type = typename std::decay::type; - using type = typename hpx::util::identity::type; - }; - } // namespace detail - - template - constexpr HPX_FORCEINLINE - tagged_tuple::type...> - make_tagged_tuple(Ts&&... ts) - { - using result_type = - tagged_tuple::type...>; - - return result_type(HPX_FORWARD(Ts, ts)...); - } - - template - constexpr HPX_FORCEINLINE - tagged_tuple::type...> - make_tagged_tuple(hpx::tuple&& t) - { - static_assert( - sizeof...(Tags) == hpx::tuple_size>::value, - "the number of tags must be identical to the size of the given " - "tuple"); - - using result_type = - tagged_tuple::type...>; - - return result_type(HPX_MOVE(t)); - } - - /////////////////////////////////////////////////////////////////////////// - namespace detail { - template - struct tagged_element_type - { - using element_type = typename hpx::tuple_element::type; - using type = typename hpx::util::identity::type; - }; - - template - struct tagged_tuple_helper; - - template - struct tagged_tuple_helper, index_pack, - Tags...> - { - using type = tagged_tuple>::type...>; - }; - } // namespace detail -}} // namespace hpx::util - -namespace hpx { - /////////////////////////////////////////////////////////////////////////// - template - struct tuple_size> - : tuple_size::type...>> - { - }; - - template - struct tuple_element> - : tuple_element::type...>> - { - }; -} // namespace hpx diff --git a/libs/core/datastructures/tests/unit/CMakeLists.txt b/libs/core/datastructures/tests/unit/CMakeLists.txt index 8781205b5129..db93a256d999 100644 --- a/libs/core/datastructures/tests/unit/CMakeLists.txt +++ b/libs/core/datastructures/tests/unit/CMakeLists.txt @@ -4,7 +4,7 @@ # 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) -set(tests any boost_any is_tuple_like unique_any tagged tuple) +set(tests any boost_any is_tuple_like unique_any tuple) if(HPX_WITH_CXX17_MEMORY_RESOURCE) set(tests ${tests} small_vector) diff --git a/libs/core/datastructures/tests/unit/tagged.cpp b/libs/core/datastructures/tests/unit/tagged.cpp deleted file mode 100644 index 6caa3f90a201..000000000000 --- a/libs/core/datastructures/tests/unit/tagged.cpp +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) 2015 Hartmut Kaiser -// -// SPDX-License-Identifier: BSL-1.0 -// 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) - -#include -#include -#include - -#include -#include - -struct A -{ - A(int val = 0) - : value_(val) - { - } - int value_; -}; - -struct B -{ - B(int val = 0) - : value_(val) - { - } - int value_; -}; - -struct C -{ - C(int val = 0) - : value_(val) - { - } - int value_; -}; - -HPX_DEFINE_TAG_SPECIFIER(tag1) // defines tag::tag1 -HPX_DEFINE_TAG_SPECIFIER(tag2) // defines tag::tag2 -HPX_DEFINE_TAG_SPECIFIER(tag3) // defines tag::tag3 - -void tagged_pair_test() -{ - typedef hpx::util::tagged_pair pair; - - static_assert(std::is_same::value, ""); - static_assert(std::is_same::value, ""); - - { - pair p; - - static_assert(std::is_same::value, ""); - static_assert(std::is_same::value, ""); - - static_assert( - std::is_same::type, - A>::value, - ""); - static_assert( - std::is_same::type, - B>::value, - ""); - } - - { - pair p(42, 43); - - HPX_TEST_EQ(p.tag1().value_, 42); - HPX_TEST_EQ(p.tag2().value_, 43); - } - - { - pair p(42, 43); - - HPX_TEST_EQ(hpx::get<0>(p).value_, 42); - HPX_TEST_EQ(hpx::get<1>(p).value_, 43); - } - - { - pair p = hpx::util::make_tagged_pair(42, 43); - - HPX_TEST_EQ(p.tag1().value_, 42); - HPX_TEST_EQ(p.tag2().value_, 43); - } - - { - pair p = hpx::util::make_tagged_pair( - std::make_pair(42, 43)); - - HPX_TEST_EQ(p.tag1().value_, 42); - HPX_TEST_EQ(p.tag2().value_, 43); - } -} - -void tagged_tuple_test() -{ - typedef hpx::util::tagged_tuple - tuple; - - { - tuple t; - - static_assert( - std::is_same::type, A>::value, - ""); - static_assert( - std::is_same::type, B>::value, - ""); - static_assert( - std::is_same::type, C>::value, - ""); - - static_assert( - std::is_same::type, - A>::value, - ""); - static_assert( - std::is_same::type, - B>::value, - ""); - static_assert( - std::is_same::type, - C>::value, - ""); - } - - { - tuple t(42, 43, 44); - - HPX_TEST_EQ(t.tag1().value_, 42); - HPX_TEST_EQ(t.tag2().value_, 43); - HPX_TEST_EQ(t.tag3().value_, 44); - } - - { - tuple t(42, 43, 44); - - HPX_TEST_EQ(hpx::get<0>(t).value_, 42); - HPX_TEST_EQ(hpx::get<1>(t).value_, 43); - HPX_TEST_EQ(hpx::get<2>(t).value_, 44); - } - - { - using hpx::util::make_tagged_tuple; - tuple t = - make_tagged_tuple(42, 43, 44); - - HPX_TEST_EQ(t.tag1().value_, 42); - HPX_TEST_EQ(t.tag2().value_, 43); - HPX_TEST_EQ(t.tag3().value_, 44); - } - - { - using hpx::util::make_tagged_tuple; - tuple t = make_tagged_tuple( - hpx::make_tuple(42, 43, 44)); - - HPX_TEST_EQ(t.tag1().value_, 42); - HPX_TEST_EQ(t.tag2().value_, 43); - HPX_TEST_EQ(t.tag3().value_, 44); - } -} - -int main() -{ - tagged_pair_test(); - tagged_tuple_test(); - - return hpx::util::report_errors(); -} From 1bdaccb5dba49765ec5817edd8f1da4405394ab1 Mon Sep 17 00:00:00 2001 From: targetakhil Date: Tue, 16 Nov 2021 21:32:41 +0530 Subject: [PATCH 3/3] remove tagspec includes from files --- .../parallel/algorithms/detail/transfer.hpp | 1 - .../hpx/parallel/algorithms/minmax.hpp | 1 - .../hpx/parallel/algorithms/partition.hpp | 3 +- .../hpx/parallel/algorithms/remove.hpp | 1 - .../hpx/parallel/algorithms/remove_copy.hpp | 1 - .../hpx/parallel/algorithms/replace.hpp | 1 - .../hpx/parallel/algorithms/reverse.hpp | 1 - .../hpx/parallel/algorithms/rotate.hpp | 1 - .../hpx/parallel/algorithms/shift_left.hpp | 1 - .../hpx/parallel/algorithms/shift_right.hpp | 1 - .../hpx/parallel/algorithms/sort_by_key.hpp | 12 +++++--- .../hpx/parallel/algorithms/transform.hpp | 1 - .../algorithms/uninitialized_move.hpp | 1 - .../hpx/parallel/algorithms/unique.hpp | 1 - .../container_algorithms/partition.hpp | 8 ++--- .../container_algorithms/remove_copy.hpp | 1 - .../parallel/container_algorithms/replace.hpp | 1 - .../parallel/container_algorithms/reverse.hpp | 1 - .../parallel/container_algorithms/rotate.hpp | 1 - .../container_algorithms/transform.hpp | 1 - .../segmented_algorithms/detail/dispatch.hpp | 30 ------------------- 21 files changed, 12 insertions(+), 58 deletions(-) diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/transfer.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/transfer.hpp index d448593498dc..347512036945 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/transfer.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/transfer.hpp @@ -13,7 +13,6 @@ #endif #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/minmax.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/minmax.hpp index c98f8893b15f..fef296ac387d 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/minmax.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/minmax.hpp @@ -376,7 +376,6 @@ namespace hpx { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/partition.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/partition.hpp index 8234818401bb..3c0082b4be82 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/partition.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/partition.hpp @@ -465,7 +465,6 @@ namespace hpx { #include #include #include -#include #include #include #include @@ -513,7 +512,7 @@ namespace hpx { namespace parallel { inline namespace v1 { std::pair::type, typename hpx::tuple_element<2, Tuple>::type>; - return lcos::make_future( + return hpx::make_future( HPX_MOVE(f), [](Tuple&& t) -> result_type { return tuple_to_pair(HPX_MOVE(t)); }); diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/remove.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/remove.hpp index 55333834f18d..d0c36776353a 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/remove.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/remove.hpp @@ -222,7 +222,6 @@ namespace hpx { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/remove_copy.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/remove_copy.hpp index ab7418001924..89273439f49e 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/remove_copy.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/remove_copy.hpp @@ -260,7 +260,6 @@ namespace hpx { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/replace.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/replace.hpp index fadc4dd63e89..bce24ddb859a 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/replace.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/replace.hpp @@ -480,7 +480,6 @@ namespace hpx { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/reverse.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/reverse.hpp index 1ff15ea164da..ab2a0291d01d 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/reverse.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/reverse.hpp @@ -188,7 +188,6 @@ namespace hpx { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp index 730b3389f10f..7ea32933fe30 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp @@ -191,7 +191,6 @@ namespace hpx { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/shift_left.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/shift_left.hpp index a15f2d7eb9d9..551badac30af 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/shift_left.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/shift_left.hpp @@ -115,7 +115,6 @@ namespace hpx { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/shift_right.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/shift_right.hpp index cf9a6fe4e09c..3425ef8d833d 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/shift_right.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/shift_right.hpp @@ -115,7 +115,6 @@ namespace hpx { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/sort_by_key.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/sort_by_key.hpp index 96b28b52a9fd..f3d952f86bfd 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/sort_by_key.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/sort_by_key.hpp @@ -11,7 +11,6 @@ #include #include -#include #include #include @@ -20,6 +19,10 @@ #include namespace hpx { namespace parallel { inline namespace v1 { + + template + using sort_by_key_result = std::pair; + /////////////////////////////////////////////////////////////////////////// // sort namespace detail { @@ -99,11 +102,11 @@ namespace hpx { namespace parallel { inline namespace v1 { /// threads, and indeterminately sequenced within each thread. /// /// \returns The \a sort_by-key algorithm returns a - /// \a hpx::future> + /// \a hpx::future> /// if the execution policy is of type /// \a sequenced_task_policy or /// \a parallel_task_policy and returns \a - /// \a std::pair + /// \a sort_by_key_result /// otherwise. /// The algorithm returns a pair holding an iterator pointing to /// the first element after the last element in the input key @@ -113,7 +116,8 @@ namespace hpx { namespace parallel { inline namespace v1 { template - util::detail::algorithm_result_t> + util::detail::algorithm_result_t> sort_by_key(ExPolicy&& policy, KeyIter key_first, KeyIter key_last, ValueIter value_first, Compare&& comp = Compare()) { diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/transform.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/transform.hpp index 34f51ed495b6..b2be35ddb26c 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/transform.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/transform.hpp @@ -189,7 +189,6 @@ namespace hpx { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/uninitialized_move.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/uninitialized_move.hpp index 242362069ada..cc517f22e8f7 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/uninitialized_move.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/uninitialized_move.hpp @@ -203,7 +203,6 @@ namespace hpx { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/unique.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/unique.hpp index 3ab739608a0f..fb523fa9fd3b 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/unique.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/unique.hpp @@ -472,7 +472,6 @@ namespace hpx { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/container_algorithms/partition.hpp b/libs/core/algorithms/include/hpx/parallel/container_algorithms/partition.hpp index eb84098f4471..a7a800ce3934 100644 --- a/libs/core/algorithms/include/hpx/parallel/container_algorithms/partition.hpp +++ b/libs/core/algorithms/include/hpx/parallel/container_algorithms/partition.hpp @@ -909,7 +909,6 @@ namespace hpx { #include #include #include -#include #include #include @@ -969,15 +968,14 @@ namespace hpx { namespace parallel { inline namespace v1 { Proj&& proj = Proj()) { using iterator = hpx::traits::range_iterator_t; - using result_type = hpx::tuple; - - static_assert(hpx::traits::is_forward_iterator_v, - "Requires at least forward iterator."); #if defined(HPX_GCC_VERSION) && HPX_GCC_VERSION >= 100000 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif + static_assert(hpx::traits::is_forward_iterator_v, + "Requires at least forward iterator."); + return parallel::util::make_in_out_out_result( partition_copy(HPX_FORWARD(ExPolicy, policy), hpx::util::begin(rng), hpx::util::end(rng), dest_true, dest_false, diff --git a/libs/core/algorithms/include/hpx/parallel/container_algorithms/remove_copy.hpp b/libs/core/algorithms/include/hpx/parallel/container_algorithms/remove_copy.hpp index 55105b3b74ae..0866de34cd5e 100644 --- a/libs/core/algorithms/include/hpx/parallel/container_algorithms/remove_copy.hpp +++ b/libs/core/algorithms/include/hpx/parallel/container_algorithms/remove_copy.hpp @@ -581,7 +581,6 @@ namespace hpx { namespace ranges { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/container_algorithms/replace.hpp b/libs/core/algorithms/include/hpx/parallel/container_algorithms/replace.hpp index 8157b7162339..874494ba1171 100644 --- a/libs/core/algorithms/include/hpx/parallel/container_algorithms/replace.hpp +++ b/libs/core/algorithms/include/hpx/parallel/container_algorithms/replace.hpp @@ -1075,7 +1075,6 @@ namespace hpx { namespace ranges { #include #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/container_algorithms/reverse.hpp b/libs/core/algorithms/include/hpx/parallel/container_algorithms/reverse.hpp index d1813495c880..06634511094f 100644 --- a/libs/core/algorithms/include/hpx/parallel/container_algorithms/reverse.hpp +++ b/libs/core/algorithms/include/hpx/parallel/container_algorithms/reverse.hpp @@ -375,7 +375,6 @@ namespace hpx { namespace ranges { #include #include -#include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/container_algorithms/rotate.hpp b/libs/core/algorithms/include/hpx/parallel/container_algorithms/rotate.hpp index 22533f31af81..36279fb0f5d4 100644 --- a/libs/core/algorithms/include/hpx/parallel/container_algorithms/rotate.hpp +++ b/libs/core/algorithms/include/hpx/parallel/container_algorithms/rotate.hpp @@ -393,7 +393,6 @@ namespace hpx { namespace ranges { #include #include #include -#include #include #include #include diff --git a/libs/core/algorithms/include/hpx/parallel/container_algorithms/transform.hpp b/libs/core/algorithms/include/hpx/parallel/container_algorithms/transform.hpp index d0ad281b6c1f..a43c9d00d82b 100644 --- a/libs/core/algorithms/include/hpx/parallel/container_algorithms/transform.hpp +++ b/libs/core/algorithms/include/hpx/parallel/container_algorithms/transform.hpp @@ -400,7 +400,6 @@ namespace hpx { namespace ranges { #include #include -#include #include #include diff --git a/libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/detail/dispatch.hpp b/libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/detail/dispatch.hpp index a19697c77147..37923ae3cab5 100644 --- a/libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/detail/dispatch.hpp +++ b/libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/detail/dispatch.hpp @@ -189,36 +189,6 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail { } }; - template - struct algorithm_result_helper< - future>, - std::enable_if_t< - hpx::traits::is_segmented_local_iterator_v || - hpx::traits::is_segmented_local_iterator_v || - hpx::traits::is_segmented_local_iterator_v>> - { - using traits1 = hpx::traits::segmented_local_iterator_traits; - using traits2 = hpx::traits::segmented_local_iterator_traits; - using traits3 = hpx::traits::segmented_local_iterator_traits; - - using arg_type = hpx::tuple; - using result_type = hpx::tuple; - - HPX_FORCEINLINE static future call(future&& f) - { - return hpx::make_future( - HPX_MOVE(f), [](arg_type&& p) -> result_type { - return hpx::make_tuple( - traits1::remote(HPX_MOVE(hpx::get<0>(p))), - traits2::remote(HPX_MOVE(hpx::get<1>(p))), - traits3::remote(HPX_MOVE(hpx::get<2>(p)))); - }); - } - }; - template struct algorithm_result_helper< future>,