Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/quickstart/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ set(disabled_tests error_handling fibonacci_await non_atomic_rma zerocopy_rdma)
if(HPX_WITH_STATIC_LINKING)
set(disabled_tests ${disabled_tests} hello_world_1)
endif()
if(HPX_WITH_DISTRIBUTED_RUNTIME)
set(disabled_tests ${disabled_tests} 1d_wave_equation)
endif()

set(1d_wave_equation_FLAGS COMPONENT_DEPENDENCIES iostreams)
set(allow_unknown_options_FLAGS COMPONENT_DEPENDENCIES iostreams)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2016 Thomas Heller
// Copyright (c) 2016-2025 Hartmut Kaiser
// Copyright (c) 2016-2026 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down Expand Up @@ -243,8 +243,8 @@ namespace hpx::util {
{
// Iterator is actually an iterator_facade, so we do not have to
// go through iterator_traits to access the traits.
using reference = typename Iterator::reference;
using value_type = typename Iterator::value_type;
using reference = Iterator::reference;
using value_type = Iterator::value_type;

public:
HPX_HOST_DEVICE explicit constexpr operator_brackets_proxy(
Expand Down Expand Up @@ -272,7 +272,7 @@ namespace hpx::util {

// We can force (not) using the operator_brackets_proxy by adding an
// embedded type use_brackets_proxy to the iterator that evaluates to
// either std::true_type of std::false_type.
// either std::true_type or std::false_type.
HPX_HAS_XXX_TRAIT_DEF(use_brackets_proxy)

// A meta-function that determines whether operator[] must return a
Expand All @@ -297,7 +297,8 @@ namespace hpx::util {
{
using type = std::conditional_t<
use_operator_brackets_proxy<Iterator, Value>::value,
operator_brackets_proxy<Iterator>, Value>;
operator_brackets_proxy<Iterator>,
typename Iterator::reference>;
};

template <typename Iterator>
Expand All @@ -308,8 +309,8 @@ namespace hpx::util {
}

template <typename Iterator>
HPX_HOST_DEVICE typename Iterator::value_type
make_operator_brackets_result(Iterator const& iter, std::false_type)
HPX_HOST_DEVICE Iterator::value_type make_operator_brackets_result(
Iterator const& iter, std::false_type)
{
return *iter;
}
Expand Down Expand Up @@ -695,21 +696,22 @@ namespace hpx::util {
#undef HPX_UTIL_ITERATOR_FACADE_INTEROP_HEAD_EX
#undef HPX_UTIL_ITERATOR_FACADE_INTEROP_HEAD

// clang-format off
HPX_CXX_EXPORT template <typename Derived, typename T, typename Category,
typename Reference, typename Distance, typename Pointer>
HPX_HOST_DEVICE constexpr std::enable_if_t<
std::is_same_v<typename Derived::iterator_category,
std::random_access_iterator_tag>,
Derived>
operator+(iterator_facade<Derived, T, Category, Reference, Distance,
Pointer> const& it,
typename Derived::difference_type
n) noexcept(noexcept(std::declval<Derived>() +=
std::declval<typename Derived::difference_type>()))
std::random_access_iterator_tag>, Derived>
operator+(iterator_facade<Derived, T, Category, Reference,
Distance, Pointer> const& it,
typename Derived::difference_type n)
noexcept(noexcept(std::declval<Derived>() +=
std::declval<typename Derived::difference_type>()))
{
Derived tmp(static_cast<Derived const&>(it));
return tmp += n;
}
// clang-format on

HPX_CXX_EXPORT template <typename Derived, typename T, typename Category,
typename Reference, typename Distance, typename Pointer>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2007-2025 Hartmut Kaiser
// Copyright (c) 2007-2026 Hartmut Kaiser
// Copyright (c) 2014 Agustin Berge
//
// SPDX-License-Identifier: BSL-1.0
Expand All @@ -16,6 +16,7 @@
#include <hpx/modules/tag_invoke.hpp>
#include <hpx/modules/type_support.hpp>

#include <concepts>
#include <cstddef>
#include <iterator>
#include <type_traits>
Expand Down Expand Up @@ -91,7 +92,7 @@ namespace hpx::util {
struct zip_iterator_category<hpx::tuple<T>,
std::enable_if_t<hpx::tuple_size<hpx::tuple<T>>::value == 1>>
{
using type = typename zip_iterator_element_category<T>::type;
using type = zip_iterator_element_category<T>::type;
};

template <typename T, typename U>
Expand Down Expand Up @@ -122,10 +123,9 @@ namespace hpx::util {
struct dereference_iterator<hpx::tuple<Ts...>>
{
template <std::size_t... Is>
HPX_HOST_DEVICE static constexpr
typename zip_iterator_reference<hpx::tuple<Ts...>>::type
call(
util::index_pack<Is...>, hpx::tuple<Ts...> const& iterators)
HPX_HOST_DEVICE static constexpr zip_iterator_reference<
hpx::tuple<Ts...>>::type
call(util::index_pack<Is...>, hpx::tuple<Ts...> const& iterators)
{
return hpx::forward_as_tuple(*hpx::get<Is>(iterators)...);
}
Expand Down Expand Up @@ -288,9 +288,9 @@ namespace hpx::util {
// the embedded iterators compares equal to hpx::default_sentinel or
// all iterators are equal. This is done to ensure that the shortest
// sequence limits the overall iteration (if detectable).
template <typename IterTuple, typename Derived_,
typename = std::enable_if_t<hpx::tuple_size_v<IterTuple> ==
hpx::tuple_size_v<IteratorTuple>>>
template <typename IterTuple, typename Derived_>
requires(hpx::tuple_size_v<IterTuple> ==
hpx::tuple_size_v<IteratorTuple>)
HPX_HOST_DEVICE constexpr bool equal(
zip_iterator_base<IterTuple, Derived_> const& other) const
noexcept(noexcept(
Expand All @@ -301,8 +301,7 @@ namespace hpx::util {
other.get_iterator_tuple());
}

HPX_HOST_DEVICE constexpr typename base_type::reference
dereference() const
HPX_HOST_DEVICE constexpr base_type::reference dereference() const
{
return dereference_iterator<IteratorTuple>::call(
util::make_index_pack_t<
Expand Down Expand Up @@ -352,9 +351,7 @@ namespace hpx::util {
template <typename Archive>
void serialize(Archive& ar, unsigned)
{
// clang-format off
ar & iterators_;
// clang-format on
}

private:
Expand Down Expand Up @@ -400,26 +397,34 @@ namespace hpx::util {
HPX_HOST_DEVICE ~zip_iterator() = default;

template <typename... Ts_>
HPX_HOST_DEVICE std::enable_if_t<
std::is_assignable_v<typename zip_iterator::iterator_tuple_type&,
typename zip_iterator<Ts_...>::iterator_tuple_type&&>,
zip_iterator&>
operator=(zip_iterator<Ts_...> const& other)
requires(std::is_assignable_v<
typename zip_iterator::iterator_tuple_type&,
typename zip_iterator<Ts_...>::iterator_tuple_type &&>)
HPX_HOST_DEVICE zip_iterator& operator=(
zip_iterator<Ts_...> const& other)
{
base_type::operator=(other.get_iterator_tuple());
return *this;
}

template <typename... Ts_>
HPX_HOST_DEVICE std::enable_if_t<
std::is_assignable_v<typename zip_iterator::iterator_tuple_type&,
typename zip_iterator<Ts_...>::iterator_tuple_type&&>,
zip_iterator&>
operator=(zip_iterator<Ts_...>&& other) noexcept
requires(std::is_assignable_v<
typename zip_iterator::iterator_tuple_type&,
typename zip_iterator<Ts_...>::iterator_tuple_type &&>)
HPX_HOST_DEVICE zip_iterator& operator=(
zip_iterator<Ts_...>&& other) noexcept
{
base_type::operator=(HPX_MOVE(other).get_iterator_tuple());
return *this;
}

HPX_HOST_DEVICE constexpr typename zip_iterator::reference operator[](
base_type::difference_type n) const
requires(std::same_as<typename zip_iterator::iterator_category,
std::random_access_iterator_tag>)
{
return *(*this + n);
}
};

HPX_CXX_EXPORT template <typename... Ts>
Expand Down Expand Up @@ -480,27 +485,35 @@ namespace hpx::util {
HPX_HOST_DEVICE ~zip_iterator() = default;

template <typename... Ts_>
HPX_HOST_DEVICE std::enable_if_t<
std::is_assignable_v<typename zip_iterator::iterator_tuple_type&,
typename zip_iterator<Ts_...>::iterator_tuple_type&&>,
zip_iterator&>
operator=(zip_iterator<Ts_...> const& other)
requires(std::is_assignable_v<
typename zip_iterator::iterator_tuple_type&,
typename zip_iterator<Ts_...>::iterator_tuple_type &&>)
HPX_HOST_DEVICE zip_iterator& operator=(
zip_iterator<Ts_...> const& other)
{
base_type::operator=(base_type(other.get_iterator_tuple()));
return *this;
}

template <typename... Ts_>
HPX_HOST_DEVICE std::enable_if_t<
std::is_assignable_v<typename zip_iterator::iterator_tuple_type&,
typename zip_iterator<Ts_...>::iterator_tuple_type&&>,
zip_iterator&>
operator=(zip_iterator<Ts_...>&& other) noexcept
requires(std::is_assignable_v<
typename zip_iterator::iterator_tuple_type&,
typename zip_iterator<Ts_...>::iterator_tuple_type &&>)
HPX_HOST_DEVICE zip_iterator& operator=(
zip_iterator<Ts_...>&& other) noexcept
{
base_type::operator=(
base_type(HPX_MOVE(other).get_iterator_tuple()));
return *this;
}

HPX_HOST_DEVICE constexpr typename zip_iterator::reference operator[](
base_type::difference_type n) const
requires(std::same_as<typename zip_iterator::iterator_category,
std::random_access_iterator_tag>)
{
return *(*this + n);
}
};

///////////////////////////////////////////////////////////////////////////
Expand All @@ -527,8 +540,7 @@ namespace hpx::traits {
HPX_CXX_EXPORT template <typename F, typename... Ts>
struct lift_zipped_iterators<F, util::zip_iterator<Ts...>>
{
using tuple_type =
typename util::zip_iterator<Ts...>::iterator_tuple_type;
using tuple_type = util::zip_iterator<Ts...>::iterator_tuple_type;
using result_type = hpx::tuple<typename element_result_of<
typename F::template apply<Ts>, Ts>::type...>;

Expand Down
6 changes: 4 additions & 2 deletions libs/core/iterator_support/tests/regressions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Copyright (c) 2019-2025 The STE||AR-Group
# Copyright (c) 2019-2026 The STE||AR-Group
#
# 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)

# Iterator tests
set(tests custom_iterator_category_6640 zip_iterator_different_range_length)
set(tests custom_iterator_category_6640 zip_iterator_different_range_length
zip_iterator_operator_brackets_proxy_6867
)

foreach(test ${tests})
set(sources ${test}.cpp)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (c) 2026 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)

// zip_iterator's operator[] doesn't agree with gcc 16's new standard library
// implementation of `std::sort` (as reported by #6867).

#include <hpx/hpx_main.hpp>
#include <hpx/modules/datastructures.hpp>
#include <hpx/modules/iterator_support.hpp>
#include <hpx/modules/testing.hpp>

#include <utility>
#include <vector>

namespace {

template <typename R1, typename R2, typename... Rs>
auto zip(R1&& r1, R2&& r2, Rs&&... rs)
{
using namespace hpx::util;
return iterator_range(
zip_iterator(r1.begin(), r2.begin(), rs.begin()...),
zip_iterator(r1.end(), r2.end(), rs.end()...));
}

void test_zip_iterator_operator_brackets_proxy()
{
std::vector<char> r1 = {'a', 'b'};
std::vector<double> r2 = {1.0, 2.0};

auto r = zip(r1, r2);
auto it = r.begin();

using std::swap;
swap(it[0], it[1]);

HPX_TEST_EQ(r1[0], 'b');
HPX_TEST_EQ(r1[1], 'a');
HPX_TEST_EQ(r2[0], 2.0);
HPX_TEST_EQ(r2[1], 1.0);
}
} // namespace

int main()
{
test_zip_iterator_operator_brackets_proxy();
return hpx::util::report_errors();
}
4 changes: 4 additions & 0 deletions libs/core/plugin/include/hpx/plugin/plugin_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <utility>
#include <vector>

#include <hpx/config/warnings_prefix.hpp>

namespace hpx::util::plugin {

///////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -326,3 +328,5 @@ namespace hpx::util::plugin {
}
};
} // namespace hpx::util::plugin

#include <hpx/config/warnings_suffix.hpp>
4 changes: 4 additions & 0 deletions libs/core/plugin/include/hpx/plugin/plugin_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <hpx/plugin/config.hpp>
#include <hpx/plugin/virtual_constructor.hpp>

#include <hpx/config/warnings_prefix.hpp>

namespace hpx::util::plugin {

///////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -42,3 +44,5 @@ namespace hpx::util::plugin {
}
};
} // namespace hpx::util::plugin

#include <hpx/config/warnings_suffix.hpp>
Loading