diff --git a/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_local_view_iterator.hpp b/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_local_view_iterator.hpp index 391ca375f902..53fa4da079b7 100644 --- a/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_local_view_iterator.hpp +++ b/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_local_view_iterator.hpp @@ -49,12 +49,7 @@ namespace hpx { template friend class const_partitioned_vector_local_view_iterator; - DataType& dereference() - { - HPX_ASSERT(!is_at_end()); - return this->base_reference()->data(); - } - DataType const& dereference() const + DataType& dereference() const { HPX_ASSERT(!is_at_end()); return this->base_reference()->data(); diff --git a/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_segmented_iterator.hpp b/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_segmented_iterator.hpp index 324fbab094d9..070e8378ae9f 100644 --- a/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_segmented_iterator.hpp +++ b/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_segmented_iterator.hpp @@ -765,13 +765,6 @@ namespace hpx::segmented { using local_iterator = typename partitioned_vector::local_iterator; - using const_segment_iterator = - typename partitioned_vector::const_segment_iterator; - using const_local_segment_iterator = - typename partitioned_vector::const_local_segment_iterator; - using const_local_iterator = - typename partitioned_vector::const_local_iterator; - // constructors vector_iterator() : data_(nullptr) @@ -1012,34 +1005,20 @@ namespace hpx::traits { // This function should specify the local iterator which is at the // beginning of the partition data. - static local_raw_iterator begin(local_segment_iterator& seg_iter) + static local_raw_iterator begin(local_segment_iterator const& seg_iter) { return local_raw_iterator( seg_iter->begin(), seg_iter.base()->local_data_); } - static local_raw_const_iterator begin( - local_segment_iterator const& seg_iter) - { - return local_raw_const_iterator( - seg_iter->begin(), seg_iter.base()->local_data_); - } - // This function should specify the local iterator which is at the // end of the partition data. - static local_raw_iterator end(local_segment_iterator& seg_iter) + static local_raw_iterator end(local_segment_iterator const& seg_iter) { return local_raw_iterator( seg_iter->end(), seg_iter.base()->local_data_); } - static local_raw_const_iterator end( - local_segment_iterator const& seg_iter) - { - return local_raw_const_iterator( - seg_iter->end(), seg_iter.base()->local_data_); - } - // Extract the base id for the segment referenced by the given segment // iterator. static id_type get_id(segment_iterator const& iter) diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/for_loop_reduction.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/for_loop_reduction.hpp index cb4490d7d7e5..171e5c5c969e 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/for_loop_reduction.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/for_loop_reduction.hpp @@ -43,11 +43,7 @@ namespace hpx::parallel::detail { { std::size_t const cores = hpx::parallel::execution::detail::get_os_thread_count(); -#if defined(HPX_HAVE_CXX17_SHARED_PTR_ARRAY) - data_ = std::make_shared[]>(cores); -#else data_.reset(new hpx::util::cache_line_data[cores]); -#endif for (std::size_t i = 0; i != cores; ++i) { data_[i].data_ = identity; diff --git a/libs/core/algorithms/include/hpx/parallel/datapar/iterator_helpers.hpp b/libs/core/algorithms/include/hpx/parallel/datapar/iterator_helpers.hpp index 2cff8d0e8136..fc9c73e02ed5 100644 --- a/libs/core/algorithms/include/hpx/parallel/datapar/iterator_helpers.hpp +++ b/libs/core/algorithms/include/hpx/parallel/datapar/iterator_helpers.hpp @@ -32,7 +32,8 @@ namespace hpx::parallel::util::detail { { static HPX_FORCEINLINE bool call(Iter& it) noexcept { - using value_type = typename std::iterator_traits::value_type; + using value_type = typename std::iterator_traits< + std::remove_const_t>::value_type; using pack_type = traits::vector_pack_type_t; return (reinterpret_cast(std::addressof(*it)) & diff --git a/libs/core/algorithms/include/hpx/parallel/datapar/zip_iterator.hpp b/libs/core/algorithms/include/hpx/parallel/datapar/zip_iterator.hpp index 56307506ff5e..5f3f0ac04ab2 100644 --- a/libs/core/algorithms/include/hpx/parallel/datapar/zip_iterator.hpp +++ b/libs/core/algorithms/include/hpx/parallel/datapar/zip_iterator.hpp @@ -40,20 +40,6 @@ namespace hpx::parallel::util::detail { { return call(it, hpx::util::make_index_pack_t()); } - - template - static HPX_FORCEINLINE constexpr bool call( - hpx::util::zip_iterator& it, hpx::util::index_pack) - { - auto& t = it.get_iterator_tuple(); - return (true && ... && is_data_aligned(hpx::get(t))); - } - - static HPX_FORCEINLINE constexpr bool call( - hpx::util::zip_iterator& it) - { - return call(it, hpx::util::make_index_pack_t()); - } }; /////////////////////////////////////////////////////////////////////////// @@ -94,28 +80,6 @@ namespace hpx::parallel::traits { typename std::iterator_traits::value_type>:: unaligned(hpx::get(t))...); } - - template - constexpr Tuple aligned_pack(hpx::util::zip_iterator& iter, - hpx::util::index_pack) - { - auto& t = iter.get_iterator_tuple(); - return hpx::make_tuple( - vector_pack_load, - typename std::iterator_traits::value_type>:: - aligned(hpx::get(t))...); - } - - template - constexpr Tuple unaligned_pack(hpx::util::zip_iterator& iter, - hpx::util::index_pack) - { - auto& t = iter.get_iterator_tuple(); - return hpx::make_tuple( - vector_pack_load, - typename std::iterator_traits::value_type>:: - unaligned(hpx::get(t))...); - } } // namespace detail template @@ -138,22 +102,6 @@ namespace hpx::parallel::traits { return traits::detail::unaligned_pack( iter, hpx::util::make_index_pack_t()); } - - template - static constexpr value_type aligned( - hpx::util::zip_iterator& iter) - { - return traits::detail::aligned_pack( - iter, hpx::util::make_index_pack_t()); - } - - template - static constexpr value_type unaligned( - hpx::util::zip_iterator& iter) - { - return traits::detail::unaligned_pack( - iter, hpx::util::make_index_pack_t()); - } }; /////////////////////////////////////////////////////////////////////////// @@ -182,30 +130,6 @@ namespace hpx::parallel::traits { unaligned(hpx::get(value), hpx::get(t)), ...); } - - template - constexpr void aligned_pack(Tuple& value, - hpx::util::zip_iterator& iter, - hpx::util::index_pack) - { - auto& t = iter.get_iterator_tuple(); - (vector_pack_store, - typename std::iterator_traits::value_type>:: - aligned(hpx::get(value), hpx::get(t)), - ...); - } - - template - constexpr void unaligned_pack(Tuple& value, - hpx::util::zip_iterator& iter, - hpx::util::index_pack) - { - auto& t = iter.get_iterator_tuple(); - (vector_pack_store, - typename std::iterator_traits::value_type>:: - unaligned(hpx::get(value), hpx::get(t)), - ...); - } } // namespace detail template @@ -226,22 +150,6 @@ namespace hpx::parallel::traits { traits::detail::unaligned_pack( value, iter, hpx::util::make_index_pack_t()); } - - template - static constexpr void aligned( - V& value, hpx::util::zip_iterator& iter) - { - traits::detail::aligned_pack( - value, iter, hpx::util::make_index_pack_t()); - } - - template - static constexpr void unaligned( - V& value, hpx::util::zip_iterator& iter) - { - traits::detail::unaligned_pack( - value, iter, hpx::util::make_index_pack_t()); - } }; } // namespace hpx::parallel::traits diff --git a/libs/core/iterator_support/include/hpx/iterator_support/counting_iterator.hpp b/libs/core/iterator_support/include/hpx/iterator_support/counting_iterator.hpp index 8dc232f17541..0f0b8ef4244c 100644 --- a/libs/core/iterator_support/include/hpx/iterator_support/counting_iterator.hpp +++ b/libs/core/iterator_support/include/hpx/iterator_support/counting_iterator.hpp @@ -84,7 +84,7 @@ namespace hpx::util { using type = iterator_adaptor, - Incrementable, Incrementable, traversal, Incrementable&, + Incrementable, Incrementable, traversal, Incrementable const&, difference>; }; } // namespace detail @@ -122,11 +122,6 @@ namespace hpx::util { { return this->base_reference(); } - - HPX_HOST_DEVICE constexpr typename base_type::reference dereference() - { - return this->base_reference(); - } }; template (n); } - HPX_HOST_DEVICE constexpr decltype(auto) dereference() const noexcept - { - return this->base_reference(); - } - - HPX_HOST_DEVICE constexpr decltype(auto) dereference() noexcept + HPX_HOST_DEVICE constexpr typename base_type::reference dereference() + const noexcept { return this->base_reference(); } diff --git a/libs/core/iterator_support/include/hpx/iterator_support/iterator_adaptor.hpp b/libs/core/iterator_support/include/hpx/iterator_support/iterator_adaptor.hpp index ac453e6c07d7..f93524b8141a 100644 --- a/libs/core/iterator_support/include/hpx/iterator_support/iterator_adaptor.hpp +++ b/libs/core/iterator_support/include/hpx/iterator_support/iterator_adaptor.hpp @@ -143,24 +143,19 @@ namespace hpx::util { return iterator_; } - HPX_HOST_DEVICE HPX_FORCEINLINE constexpr Base& base() noexcept - { - return iterator_; - } - protected: // for convenience in derived classes using iterator_adaptor_ = iterator_adaptor; // lvalue access to the Base object for Derived - HPX_HOST_DEVICE HPX_FORCEINLINE Base& base_reference() noexcept + HPX_HOST_DEVICE HPX_FORCEINLINE constexpr Base const& base_reference() + const noexcept { return iterator_; } - HPX_HOST_DEVICE HPX_FORCEINLINE constexpr Base const& base_reference() - const noexcept + HPX_HOST_DEVICE HPX_FORCEINLINE Base& base_reference() noexcept { return iterator_; } diff --git a/libs/core/iterator_support/include/hpx/iterator_support/iterator_facade.hpp b/libs/core/iterator_support/include/hpx/iterator_support/iterator_facade.hpp index 5b8b45a3edde..9f519933fb09 100644 --- a/libs/core/iterator_support/include/hpx/iterator_support/iterator_facade.hpp +++ b/libs/core/iterator_support/include/hpx/iterator_support/iterator_facade.hpp @@ -14,7 +14,6 @@ #pragma once #include -#include #include #include @@ -62,23 +61,12 @@ namespace hpx::util { it.decrement(); } - template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr Reference dereference( - Iterator& it) -#if !defined(HPX_MSVC) - // MSVC has issues with this - noexcept(noexcept(std::declval().dereference())) -#endif - { - return it.dereference(); - } - template HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr Reference dereference( Iterator const& it) #if !defined(HPX_MSVC) // MSVC has issues with this - noexcept(noexcept(std::declval().dereference())) + noexcept(noexcept(std::declval().dereference())) #endif { return it.dereference(); @@ -117,18 +105,12 @@ namespace hpx::util { { } - HPX_HOST_DEVICE HPX_FORCEINLINE constexpr decltype(auto) + HPX_HOST_DEVICE HPX_FORCEINLINE constexpr Reference* operator->() noexcept { return std::addressof(ref_); } - HPX_HOST_DEVICE HPX_FORCEINLINE constexpr decltype(auto) - operator->() const noexcept - { - return std::addressof(ref_); - } - Reference ref_; }; @@ -146,37 +128,13 @@ namespace hpx::util { { using type = T*; - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr decltype(auto) - call(T& x) noexcept - { - return std::addressof(x); - } - }; - - template - struct arrow_dispatch // "real" references - { - using type = T const*; - - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr decltype(auto) - call(T const& x) noexcept + HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr type call( + T& x) noexcept { return std::addressof(x); } }; - template - struct make_const_reference - { - using type = std::conditional_t, - std::add_lvalue_reference_t< - std::add_const_t>>, - std::add_const_t>; - }; - - template - using make_const_reference_t = typename make_const_reference::type; - template using arrow_dispatch_t = typename arrow_dispatch::type; @@ -207,37 +165,20 @@ namespace hpx::util { return *static_cast(this); } - using const_reference = make_const_reference_t; - public: - // HPX_HOST_DEVICE constexpr decltype(auto) operator*() noexcept( - // noexcept(iterator_core_access::dereference( - // std::declval()))) - // { - // return iterator_core_access::dereference( - // this->derived()); - // } - HPX_HOST_DEVICE constexpr decltype(auto) operator*() const noexcept(noexcept(iterator_core_access::dereference( - std::declval()))) + std::declval()))) { return iterator_core_access::dereference( this->derived()); } - // HPX_HOST_DEVICE constexpr decltype(auto) operator->() noexcept( - // noexcept(iterator_core_access::dereference( - // std::declval()))) - // { - // return arrow_dispatch::call(*this->derived()); - // } - - HPX_HOST_DEVICE constexpr decltype(auto) operator->() const + HPX_HOST_DEVICE constexpr pointer operator->() const noexcept(noexcept(iterator_core_access::dereference( - std::declval()))) + std::declval()))) { - return arrow_dispatch::call(*this->derived()); + return arrow_dispatch::call(*this->derived()); } HPX_HOST_DEVICE Derived& operator++() noexcept(noexcept( @@ -309,8 +250,8 @@ namespace hpx::util { { } - HPX_HOST_DEVICE constexpr operator reference() noexcept( - noexcept(*std::declval())) + HPX_HOST_DEVICE constexpr operator reference() const + noexcept(noexcept(*std::declval())) { return *iter_; } diff --git a/libs/core/iterator_support/include/hpx/iterator_support/zip_iterator.hpp b/libs/core/iterator_support/include/hpx/iterator_support/zip_iterator.hpp index 7dce86753bb9..b7c4f4784be6 100644 --- a/libs/core/iterator_support/include/hpx/iterator_support/zip_iterator.hpp +++ b/libs/core/iterator_support/include/hpx/iterator_support/zip_iterator.hpp @@ -124,15 +124,10 @@ namespace hpx::util { struct dereference_iterator> { template - HPX_HOST_DEVICE static constexpr decltype(auto) call( - util::index_pack, hpx::tuple& iterators) - { - return hpx::forward_as_tuple(*hpx::get(iterators)...); - } - - template - HPX_HOST_DEVICE static constexpr decltype(auto) call( - util::index_pack, hpx::tuple const& iterators) + HPX_HOST_DEVICE static constexpr + typename zip_iterator_reference>::type + call( + util::index_pack, hpx::tuple const& iterators) { return hpx::forward_as_tuple(*hpx::get(iterators)...); } @@ -312,15 +307,8 @@ namespace hpx::util { } } - HPX_HOST_DEVICE constexpr decltype(auto) dereference() - { - return dereference_iterator::call( - util::make_index_pack_t< - hpx::tuple_size::value>(), - iterators_); - } - - HPX_HOST_DEVICE constexpr decltype(auto) dereference() const + HPX_HOST_DEVICE constexpr typename base_type::reference + dereference() const { return dereference_iterator::call( util::make_index_pack_t< @@ -378,12 +366,6 @@ namespace hpx::util { private: IteratorTuple iterators_; }; - - template - struct make_const_reference> - { - using type = hpx::tuple...>; - }; } // namespace detail template diff --git a/libs/core/program_options/include/hpx/program_options/eof_iterator.hpp b/libs/core/program_options/include/hpx/program_options/eof_iterator.hpp index 6f3e294ae34e..c46887603ffd 100644 --- a/libs/core/program_options/include/hpx/program_options/eof_iterator.hpp +++ b/libs/core/program_options/include/hpx/program_options/eof_iterator.hpp @@ -80,11 +80,6 @@ namespace hpx { namespace program_options { return m_at_eof && other.m_at_eof; } - ValueType& dereference() noexcept - { - return m_value; - } - ValueType const& dereference() const noexcept { return m_value; diff --git a/libs/full/collectives/include/hpx/collectives/gather.hpp b/libs/full/collectives/include/hpx/collectives/gather.hpp index 5931f2deb1d2..537dc92cc95c 100644 --- a/libs/full/collectives/include/hpx/collectives/gather.hpp +++ b/libs/full/collectives/include/hpx/collectives/gather.hpp @@ -470,8 +470,8 @@ namespace hpx::collectives { root_site_arg root_site = root_site_arg()) { HPX_ASSERT(this_site != root_site); - gather_there(create_communicator(basename, num_sites_arg(), - this_site, generation, root_site), + gather_there(create_communicator(basename, num_sites_arg(), this_site, + generation, root_site), HPX_FORWARD(T, local_result), this_site) .get(); }