Skip to content

Commit

Permalink
sue rangges for iterator traits
Browse files Browse the repository at this point in the history
  • Loading branch information
alfC committed Feb 18, 2025
1 parent dd63476 commit 55b2ea6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/boost/multi/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
# endif
#endif

#if __has_include(<ranges>)
# include <ranges>
#endif

// TODO(correaa) or should be (__CUDA__) or CUDA__ || HIP__
#if defined(__NVCC__)
#define BOOST_MULTI_HD __host__ __device__
Expand Down Expand Up @@ -252,7 +256,12 @@ struct static_array // NOLINT(fuchsia-multiple-inheritance) : multiple inherita

template<
class Range, class = std::enable_if_t<!std::is_base_of<static_array, std::decay_t<Range>>{}>,
#if defined(__cpp_lib_ranges) && (__cpp_lib_ranges >= 201911L)
class = typename std::ranges::iterator_t<Range>, // this solves a problem in cuda 11.x when element_iterator is made to be pointer-like
#else
class = typename Range::iterator, // this solves a problem in cuda 11.x when element_iterator is made to be pointer-like
#endif
// class = decltype(std::declval<Range const&>().begin(), std::declval<Range const&>().end()),
// class = decltype(/*static_array*/ (std::declval<Range const&>().begin() - std::declval<Range const&>().end())), // instantiation of static_array here gives a compiler error in 11.0, partially defined type?
class = std::enable_if_t<! is_subarray<Range const&>::value> // NOLINT(modernize-use-constraints) TODO(correaa) in C++20
>
Expand Down

0 comments on commit 55b2ea6

Please sign in to comment.