20 #ifndef RAJA_util_for_each_HPP
21 #define RAJA_util_for_each_HPP
23 #include "RAJA/config.hpp"
26 #include <type_traits>
28 #include "camp/list.hpp"
43 template<
typename Iter,
typename UnaryFunc>
48 for (; begin != end; ++begin)
58 template<
typename UnaryFunc,
typename... Ts>
63 int seq_unused_array[] = {0, (func(Ts {}), 0)...};
71 template<
typename Tuple,
typename UnaryFunc, camp::idx_t... Is>
77 int seq_unused_array[] = {0, (func(get<Is>(std::forward<Tuple>(t))), 0)...};
91 template<
typename Container,
typename UnaryFunc>
93 concepts::enable_if_t<UnaryFunc, type_traits::is_range<Container>>
107 template<
typename UnaryFunc,
typename... Ts>
119 template<
typename Tuple,
typename UnaryFunc>
124 std::forward<Tuple>(t), std::move(func),
125 camp::make_idx_seq_t<std::tuple_size<camp::decay<Tuple>>::value> {});
Header file for RAJA algorithm definitions.
Header file for common RAJA internal macro definitions.
RAJA_HOST_DEVICE RAJA_INLINE void RAJA_UNUSED_VAR(T &&...) noexcept
Definition: macros.hpp:120
#define RAJA_HOST_DEVICE
Definition: macros.hpp:65
#define RAJA_SUPPRESS_HD_WARN
Definition: macros.hpp:68
constexpr RAJA_SUPPRESS_HD_WARN RAJA_HOST_DEVICE RAJA_INLINE UnaryFunc for_each(Iter begin, Iter end, UnaryFunc func)
Definition: for_each.hpp:44
constexpr RAJA_SUPPRESS_HD_WARN RAJA_HOST_DEVICE RAJA_INLINE UnaryFunc for_each_tuple(Tuple &&t, UnaryFunc func, camp::idx_seq< Is... >)
Definition: for_each.hpp:73
constexpr RAJA_SUPPRESS_HD_WARN RAJA_HOST_DEVICE RAJA_INLINE UnaryFunc for_each_type(camp::list< Ts... > const &, UnaryFunc func)
Definition: for_each.hpp:60
Definition: AlignedRangeIndexSetBuilders.cpp:35
RAJA_HOST_DEVICE constexpr RAJA_INLINE RAJA::zip_tuple_element_t< I, zip_tuple< is_val, Ts... > > & get(zip_tuple< is_val, Ts... > &z) noexcept
Definition: zip_tuple.hpp:56
constexpr RAJA_SUPPRESS_HD_WARN RAJA_HOST_DEVICE RAJA_INLINE UnaryFunc for_each_type(camp::list< Ts... > const &c, UnaryFunc func)
Apply func to each type in the given list in order using a compile-time expansion in O(N) operations ...
Definition: for_each.hpp:109
constexpr RAJA_SUPPRESS_HD_WARN RAJA_HOST_DEVICE RAJA_INLINE concepts::enable_if_t< UnaryFunc, type_traits::is_range< Container > > for_each(Container &&c, UnaryFunc func)
Apply func to all the elements in the given range in order using a sequential for loop in O(N) operat...
Definition: for_each.hpp:94
constexpr RAJA_SUPPRESS_HD_WARN RAJA_HOST_DEVICE RAJA_INLINE UnaryFunc for_each_tuple(Tuple &&t, UnaryFunc func)
Apply func to each object in the given tuple or tuple like type in order using a compile-time expansi...
Definition: for_each.hpp:120
Header file for RAJA type definitions.