8#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MDSPAN_LAYOUT_LEFT_HPP_
9#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MDSPAN_LAYOUT_LEFT_HPP_
14#include "arene/base/array/array.hpp"
15#include "arene/base/constraints/constraints.hpp"
16#include "arene/base/contracts/contract.hpp"
17#include "arene/base/mdspan/detail/all_valid_submdspan_slice_types_for.hpp"
18#include "arene/base/mdspan/detail/checked_math.hpp"
19#include "arene/base/mdspan/detail/is_submdspan_layout_preserving.hpp"
20#include "arene/base/mdspan/detail/layout_common.hpp"
21#include "arene/base/mdspan/detail/strided_mapping_base.hpp"
22#include "arene/base/mdspan/detail/submdspan_mapping_impl.hpp"
23#include "arene/base/mdspan/submdspan_subextents_type.hpp"
24#include "arene/base/stdlib_choice/enable_if.hpp"
25#include "arene/base/stdlib_choice/is_constructible.hpp"
26#include "arene/base/stdlib_choice/is_convertible.hpp"
27#include "arene/base/stdlib_choice/move.hpp"
35namespace layout_detail {
42template <
typename Extents, constraints<std::enable_if_t<Extents::rank() != 0U>> =
nullptr>
43constexpr auto left_strides(Extents
const& extents)
noexcept
44 -> ::arene::base::array<
typename Extents::index_type, Extents::rank()> {
45 using index_type =
typename Extents::index_type;
46 using rank_type =
typename Extents::rank_type;
48 ::arene::base::array<index_type, Extents::rank()> strides{};
49 mdspan_detail::checked_math_result<index_type> current_stride{index_type{1}};
50 strides[0U] = current_stride.value;
51 for (rank_type dim{}; dim + rank_type{1} < Extents::rank(); ++dim) {
52 current_stride = mdspan_detail::checked_multiplies<index_type>(current_stride, extents.extent(dim));
53 if (current_stride.value == index_type{}) {
56 current_stride.value = index_type{1};
58 strides[dim + rank_type{1}] = current_stride.value;
60 ARENE_PRECONDITION(!current_stride.overflowed);
69template <
typename Extents, constraints<std::enable_if_t<Extents::rank() == 0U>> =
nullptr>
70constexpr auto left_strides(Extents
const&)
noexcept
71 -> ::arene::base::array<
typename Extents::index_type, Extents::rank()> {
83template <
class Extents>
108 constexpr mapping(extents_type
const& exts)
noexcept
A mapping from a logical pack of indices into a single flat physical output index.
Definition layout_left.hpp:84
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_left.hpp:234
constexpr mapping(extents_type const &exts) noexcept
Construct a left-strided mapping for the given extents.
Definition layout_left.hpp:108
constexpr mapping() noexcept
Construct a default left-strided mapping for the given extents.
Definition layout_left.hpp:99
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_left.hpp:240
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10