24 Containers library [containers]

24.7 Views [views]

24.7.3 Multidimensional access [views.multidim]

24.7.3.4 Layout mapping [mdspan.layout]

24.7.3.4.9 Class template layout_right_padded​::​mapping [mdspan.layout.rightpad]

24.7.3.4.9.3 Constructors [mdspan.layout.rightpad.cons]

constexpr mapping(const extents_type& ext);
Preconditions:
  • The size of the multidimensional index space ext is representable as a value of type index_type.
  • If rank_ is greater than one and padding_value does not equal dynamic_extent, then LEAST-MULTIPLE-AT-LEAST(padding_value, ext.extent(rank_ - 1)) is representable as a value of type index_type.
  • If rank_ is greater than one and padding_value does not equal dynamic_extent, then the product of LEAST-MULTIPLE-AT-LEAST(padding_value, ext.extent(rank_ - 1)) and all values ext.extent(k) with k in the range of [0, rank_ - 1) is representable as a value of type index_type.
Effects:
  • Direct-non-list-initializes extents_ with ext; and
  • if rank_ is greater than one, direct-non-list-initializes stride-rm2
    • with ext.extent(rank_ - 1) if padding_value is dynamic_extent,
    • otherwise with LEAST-MULTIPLE-AT-LEAST(padding_value, ext.extent(rank_ - 1)).
template<class OtherIndexType> constexpr mapping(const extents_type& ext, OtherIndexType pad);
Constraints:
  • is_convertible_v<OtherIndexType, index_type> is true.
  • is_nothrow_constructible_v<index_type, OtherIndexType> is true.
Preconditions:
  • pad is representable as a value of type index_type.
  • extents_type​::​index-cast(pad) is greater than zero.
  • If rank_ is greater than one, then LEAST-MULTIPLE-AT-LEAST(pad, ext.extent(rank_ - 1)) is representable as a value of type index_type.
  • If rank_ is greater than one, then the product of LEAST-MULTIPLE-AT-LEAST(pad, ext.extent(
    rank_
    - 1))
    and all values ext.extent(k) with k in the range of [0, rank_ - 1) is representable as a value of type index_type.
  • If padding_value is not equal to dynamic_extent, padding_value equals extents_type​::​
    index-cast(pad)
    .
Effects: Direct-non-list-initializes extents_ with ext, and if rank_ is greater than one, direct-non-list-initializes stride-rm2 with LEAST-MULTIPLE-AT-LEAST(pad, ext.extent(rank_ - 1)).
template<class OtherExtents> constexpr explicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const layout_right::mapping<OtherExtents>& other);
Constraints: is_constructible_v<extents_type, OtherExtents> is true.
Mandates: If OtherExtents​::​rank() is greater than 1, then (static-padding-stride == dynamic_extent) || (OtherExtents::static_extent(rank_ - 1) == dynamic_extent) || (static-padding-stride == OtherExtents::static_extent(rank_ - 1)) is true.
Preconditions:
  • If rank_ > 1 is true and padding_value == dynamic_extent is false, then other.stride(
    rank_ - 2)
    equals LEAST-MULTIPLE-AT-LEAST(padding_value, extents_type::index-cast(other.extents().extent(rank_ - 1))) and
  • other.required_span_size() is representable as a value of type index_type.
Effects: Equivalent to mapping(other.extents()).
template<class OtherExtents> constexpr explicit(rank_ > 0) mapping(const layout_stride::mapping<OtherExtents>& other);
Constraints: is_constructible_v<extents_type, OtherExtents> is true.
Preconditions:
  • If rank_ is greater than 1 and padding_value does not equal dynamic_extent, then other.
    stride(rank_ - 2)
    equals LEAST-MULTIPLE-AT-LEAST(padding_value, extents_type::index-cast(other.extents().extent(rank_ - 1)))
  • If rank_ is greater than 0, then other.stride(rank_ - 1) equals 1.
  • If rank_ is greater than 2, then for all r in the range [0, rank_ - 2), other.stride(r) equals (other.extents().rev-prod-of-extents(r) / other.extents().extent(rank_ - 1)) * other.stride(rank_ - 2)
  • other.required_span_size() is representable as a value of type index_type.
Effects:
  • Direct-non-list-initializes extents_ with other.extents(); and
  • if rank_ is greater than one, direct-non-list-initializes stride-rm2 with other.stride(rank_ - 2).
template<class LayoutRightPaddedMapping> constexpr explicit( see below ) mapping(const LayoutRightPaddedMapping& other);
Constraints:
  • is-layout-right-padded-mapping-of<LayoutRightPaddedMapping> is true.
  • is_constructible_v<extents_type, typename LayoutRightPaddedMapping​::​extents_-
    type>
    is true.
Mandates: If rank_ is greater than 1, then padding_value == dynamic_extent || LayoutRightPaddedMapping::padding_value == dynamic_extent || padding_value == LayoutRightPaddedMapping::padding_value is true.
Preconditions:
  • If rank_ is greater than 1 and padding_value does not equal dynamic_extent, then other.
    stride(rank_ - 2)
    equals LEAST-MULTIPLE-AT-LEAST(padding_value, extents_type::index-cast(other.extent(rank_ - 1)))
  • other.required_span_size() is representable as a value of type index_type.
Effects:
  • Direct-non-list-initializes extents_ with other.extents(); and
  • if rank_ is greater than one, direct-non-list-initializes stride-rm2 with other.stride(rank_ - 2).
Remarks: The expression inside explicit is equivalent to: rank_ > 1 && (padding_value != dynamic_extent || LayoutRightPaddedMapping::padding_value == dynamic_extent)
template<class LayoutLeftPaddedMapping> constexpr explicit( see below ) mapping(const LayoutLeftPaddedMapping& other) noexcept;
Constraints:
  • is-layout-left-padded-mapping-of<LayoutLeftPaddedMapping> is true or
    is-mapping-of<layout_left, LayoutLeftPaddedMapping> is true.
  • rank_ equals zero or one.
  • is_constructible_v<extents_type, typename LayoutLeftPaddedMapping​::​extents_type>
    is true.
Preconditions: other.required_span_size() is representable as a value of type index_type.
Effects: Direct-non-list-initializes extents_ with other.extents().
Remarks: The expression inside explicit is equivalent to: !is_convertible_v<typename LayoutLeftPaddedMapping::extents_type, extents_type>
[Note 1: 
Neither the input mapping nor the mapping to be constructed uses the padding stride in the rank-0 or rank-1 case, so the padding stride affects neither the constraints nor the preconditions.
— end note]