8#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MDSPAN_LAYOUT_RIGHT_HPP_
9#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MDSPAN_LAYOUT_RIGHT_HPP_
16#include "arene/base/mdspan/detail/all_valid_submdspan_slice_types_for.hpp"
17#include "arene/base/mdspan/detail/is_submdspan_layout_preserving.hpp"
18#include "arene/base/mdspan/detail/layout_common.hpp"
19#include "arene/base/mdspan/detail/strided_mapping_base.hpp"
20#include "arene/base/mdspan/detail/submdspan_mapping_impl.hpp"
22#include "arene/base/stdlib_choice/enable_if.hpp"
23#include "arene/base/stdlib_choice/is_constructible.hpp"
24#include "arene/base/stdlib_choice/is_convertible.hpp"
25#include "arene/base/stdlib_choice/move.hpp"
40template <
class Extents>
44 using base_type = layout_detail::strided_mapping_base<Extents>;
47 using typename base_type::extents_type;
48 using typename base_type::index_type;
49 using typename base_type::rank_type;
50 using typename base_type::size_type;
65 constexpr mapping(extents_type
const& exts) noexcept
66 : base_type(exts, layout_detail::right_strides(exts)) {}
76 typename OtherExtents,
80 :
mapping(layout_detail::extents_cast<extents_type>(other.extents())) {}
91 typename OtherExtents,
96 :
mapping(layout_detail::extents_cast<extents_type>(other.extents())) {}
107 typename OtherExtents,
113 :
mapping(layout_detail::extents_cast<extents_type>(other.extents())) {}
124 typename OtherExtents,
130 :
mapping(layout_detail::extents_cast<extents_type>(other.extents())) {}
143 typename OtherExtents,
149 :
mapping(layout_detail::extents_cast<extents_type>(other.extents())) {
164 typename OtherExtents,
169 :
mapping(layout_detail::extents_cast<extents_type>(other.extents())) {
171 layout_detail::precondition_strides_equal<index_type, typename OtherExtents::index_type>(
178 using base_type::extents;
179 using base_type::required_span_size;
180 using base_type::stride;
181 using base_type::operator();
183 using base_type::is_always_strided;
184 using base_type::is_always_unique;
185 using base_type::is_strided;
186 using base_type::is_unique;
207 typename OtherExtents,
210 return left.extents() == right.extents();
219 typename OtherExtents,
222 return !(left == right);
231 static constexpr auto passkey() noexcept -> layout_detail::check_bypasser {
return layout_detail::check_bypasser{}; }
243 static constexpr auto strides_of(
mapping const& src)
noexcept
245 return src.strides();
284 class... CanonicalSliceSpecifiers,
286 std::enable_if_t<
sizeof...(CanonicalSliceSpecifiers) == extents_type::rank()>,
288 mdspan_detail::all_valid_submdspan_slice_types_for_v<extents_type, CanonicalSliceSpecifiers...>>> =
291#ifdef ARENE_DOC_GENERATION_RUNNING
295 ->
decltype(mdspan_detail::submdspan_mapping_impl<
297 mdspan_detail::is_submdspan_layout_preserving<
300 CanonicalSliceSpecifiers...>{},
303 mapping::strides_of(src),
306 return mdspan_detail::submdspan_mapping_impl<
308 mdspan_detail::is_submdspan_layout_preserving<
311 CanonicalSliceSpecifiers...>{},
A fixed-size array of T objects.
Definition array.hpp:77
A mapping from a logical pack of indices into a single flat physical output index.
Definition layout_left.hpp:86
A mapping from a logical pack of indices into a single flat physical output index.
Definition layout_right.hpp:41
static constexpr auto is_always_exhaustive() noexcept -> bool
Return whether or not this mapping is always exhaustive, i.e. every element is reachable using some i...
Definition layout_right.hpp:191
friend constexpr auto operator!=(mapping const &left, mapping< OtherExtents > const &right) noexcept -> bool
Compare two right-strided mappings for inequality.
Definition layout_right.hpp:221
constexpr mapping(layout_stride::mapping< OtherExtents > const &other) noexcept
Converting constructor from a layout_stride::mapping with a compatible extents_type.
Definition layout_right.hpp:148
friend constexpr auto operator==(mapping const &left, mapping< OtherExtents > const &right) noexcept -> bool
Compare two right-strided mappings for equality.
Definition layout_right.hpp:209
static constexpr auto is_exhaustive() noexcept -> bool
Return whether or not this instance is exhaustive, i.e. every element is reachable using some indices...
Definition layout_right.hpp:197
constexpr mapping(layout_left::mapping< OtherExtents > const &other) noexcept
Converting constructor from a layout_left::mapping when both have 0- or 1-dimensional extents.
Definition layout_right.hpp:112
constexpr mapping(extents_type const &exts) noexcept
Construct a right-strided mapping for the given extents.
Definition layout_right.hpp:65
constexpr mapping() noexcept
Construct a right-strided mapping for a default-constructed set of extents.
Definition layout_right.hpp:56
constexpr mapping(mapping< OtherExtents > const &other) noexcept
Converting constructor from a mapping with a different (but compatible) extents_type.
Definition layout_right.hpp:79
layout_right layout_type
The tag type of the layout used by this mapping.
Definition layout_right.hpp:52
friend constexpr auto submdspan_mapping(mapping const &src, CanonicalSliceSpecifiers... slices) noexcept
Compute the sub-mapping for a layout_right::mapping.
A mapping from a logical pack of indices into a single flat physical output index,...
Definition layout_stride.hpp:192
Definition accumulate.hpp:37
typename submdspan_subextents_type< Extents, SliceSpecifiers... >::type submdspan_subextents_type_t
determines the subextents type from an extents type and slice specifiers
Definition submdspan_subextents_type.hpp:124
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
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