23 Containers library [containers]

23.7 Views [views]

23.7.3 Multidimensional access [views.multidim]

23.7.3.7 submdspan [mdspan.sub]

23.7.3.7.7 Specializations of submdspan_mapping [mdspan.sub.map]

23.7.3.7.7.1 Sliceable layout mapping requirements [mdspan.sub.map.sliceable]

Let:
  • M denote a layout mapping class;
  • IT denote M​::​extent_type​::​index_type;
  • m denote a value of type (possibly const) M;
  • M_rank be equal to M​::​extent_type​::​rank();
  • valid_slices denote a pack of (possibly const) objects for which sizeof...(valid_slices) == M_rank is true and, for each rank index i of m.extents(), valid_slices...[i] is a valid submdspan slice for the extent of m.extents();
  • invalid_slices denote a pack of objects for which sizeof...(invalid_slices) == M_rank is true and there exists an integer k such that the cv-unqualified type of invalid_slices...[k] is none of the following:
For the purpose of this section, the meaning of submdspan_mapping is established as if by performing argument-dependent lookup only ([basic.lookup.argdep]).
A type M meets the sliceable layout mapping requirements if
  • M meets the layout mapping requirements ([mdspan.layout.policy.reqmts]),
  • the expression submdspan_mapping(m, invalid_slices...) is ill-formed, and
  • the following expression is well-formed and has the specified semantics: submdspan_mapping(m, valid_slices...)
Result: A type SMR that is a specialization of type submdspan_mapping_result<SM> for some type SM such that
  • SM meets the layout mapping requirements ([mdspan.layout.policy.reqmts]),
  • SM​::​extents_type is a specialization of extents,
  • SM​::​extents_type​::​rank() equals MAP_RANK(valid_slices, M_rank), and
  • SM​::​extents_type​::​index_type denotes IT.
Returns: An object smr of type SMR such that
  • smr.mapping.extents() == submdspan_extents(m.extents(), valid_slices...) is true;
    and
  • for each integer pack i which is a multidimensional index in smr.mapping.extents(),
    smr.mapping(i...) + smr.offset == m(j) is true, where j is an integer pack such that
    • sizeof...(j) is equal to M_rank; and
    • for each rank index ρ of m.extents(), j...[ρ] is equal to the sum of
      • the lower bound of the submdspan slice range of valid_slices...[ρ] for extent ρ of m.extents(), and
      • zero if the type of valid_slices...[ρ] is a collapsing slice type, i...[MAP_RANK(valid_slices,ρ)] otherwise.
template<class LayoutMapping> concept sliceable-mapping = see below;
Let lm be an object of type LayoutMapping and let fe denote a pack of objects of type full_extent_t for which sizeof...(fe) == LayoutMapping​::​extents_type​::​rank() is true.
A type LayoutMapping satisfies sliceable-mapping if
  • the expression submdspan_mapping(m, fe...) is well-formed when treated as an unevaluated operand, and
  • the type of that expression is a specialization of submdspan_mapping_result.
A type LayoutMapping models sliceable-mapping if LayoutMapping meets the sliceable layout mapping requirements.