7#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MDSPAN_SUBMDSPAN_HPP_
8#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MDSPAN_SUBMDSPAN_HPP_
13#include "arene/base/mdspan/detail/do_submdspan_mapping.hpp"
14#include "arene/base/mdspan/detail/mandate_each_argtype_is_submdspan_slice.hpp"
18#include "arene/base/stdlib_choice/cstddef.hpp"
19#include "arene/base/stdlib_choice/declval.hpp"
20#include "arene/base/stdlib_choice/enable_if.hpp"
21#include "arene/base/stdlib_choice/move.hpp"
28namespace submdspan_detail {
34template <
class Mapping,
class Extents,
class... SliceSpecifiers>
50template <
class ElementType,
class Extents,
class LayoutPolicy,
class AccessorPolicy,
class... SliceSpecifiers>
51constexpr auto sub_mdspan_impl(priority_tag<1>) -> mdspan<
53 typename sub_mapping_t<typename LayoutPolicy::template mapping<Extents>, Extents, SliceSpecifiers...>::extents_type,
54 typename sub_mapping_t<typename LayoutPolicy::template mapping<Extents>, Extents, SliceSpecifiers...>::layout_type,
55 typename AccessorPolicy::offset_policy>;
61constexpr auto sub_mdspan_impl(priority_tag<0>) -> void;
70template <
class ElementType,
class Extents,
class LayoutPolicy,
class AccessorPolicy,
class... SliceSpecifiers>
72 decltype(sub_mdspan_impl<ElementType, Extents, LayoutPolicy, AccessorPolicy, SliceSpecifiers...>(priority_tag<1>{})
114 class AccessorPolicy,
115 class... SliceSpecifiers,
117 mdspan_detail::mandate_each_argtype_is_submdspan_slice<
typename Extents::index_type, SliceSpecifiers...>(),
122 operator()(mdspan<ElementType, Extents, LayoutPolicy, AccessorPolicy>
const& src, SliceSpecifiers... slices)
const
123 noexcept(
is_nothrow_invocable_v<
decltype(submdspan_canonicalize_slices), Extents
const&, SliceSpecifiers&&...>)
124 -> sub_mdspan_t<ElementType, Extents, LayoutPolicy, AccessorPolicy, SliceSpecifiers...> {
125 auto const sub_map_offset = apply(
126 bind_front(mdspan_detail::do_submdspan_mapping, src.mapping()),
127 submdspan_canonicalize_slices(src.extents(),
std::move(slices)...)
130 using sub_mapping =
decltype(sub_map_offset.mapping);
134 typename sub_mapping::extents_type,
135 typename sub_mapping::layout_type,
136 typename AccessorPolicy::offset_policy>{
137 src.accessor().offset(src.data_handle(), sub_map_offset.offset),
138 sub_map_offset.mapping,
139 typename AccessorPolicy::offset_policy{src.accessor()}
#define ARENE_CPP14_INLINE_VARIABLE(type, name)
Emulates C++17's inline variable declarations for function objects.
Definition cpp14_inline.hpp:69
Definition accumulate.hpp:37
constexpr bool is_nothrow_invocable_v
Determine if a functor type is no-throw invocable with the specified argument types.
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
Definition accumulate.hpp:36
typedef nullptr_t
The type of nullptr.
Definition cstddef.hpp:33
constexpr auto move(T &&value) noexcept -> remove_reference_t< T > &&
Cast a value to an rvalue.
Definition move.hpp:30
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41
auto declval() noexcept -> T &&
A dummy function that is declared but not defined, with a user-specified return type,...