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.8 Class template layout_left_padded​::​mapping [mdspan.layout.leftpad]

24.7.3.4.8.3 Constructors [mdspan.layout.leftpad.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(0)) 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(0)) and all values ext.extent(k) with k in the range of [1, rank_) 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-1
    • with ext.extent(0) if padding_value is dynamic_extent,
    • otherwise with LEAST-MULTIPLE-AT-LEAST(padding_value, ext.extent(0)).
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(0)) 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(
    0))
    and all values ext.extent(k) with k in the range of [1, rank_) 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-1 with LEAST-MULTIPLE-AT-LEAST(pad, ext.extent(0)).
template<class OtherExtents> constexpr explicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const layout_left::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(0) == dynamic_extent) || (static-padding-stride== OtherExtents::static_extent(0)) is true.
Preconditions:
  • If extents_type​::​rank() > 1 is true and padding_value == dynamic_extent is false, then other.stride(1) equals LEAST-MULTIPLE-AT-LEAST(padding_value, extents_type::index-cast(other.extents().extent(0))) 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(1)
    equals LEAST-MULTIPLE-AT-LEAST(padding_value, extents_type::index-cast(other.extents().extent(0)))
  • If rank_ is greater than 0, then other.stride(0) equals 1.
  • If rank_ is greater than 2, then for all r in the range [2, rank_), other.stride(r) equals (other.extents().fwd-prod-of-extents(r) / other.extents().extent(0)) * other.stride(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-1 with other.stride(1).
template<class LayoutLeftPaddedMapping> constexpr explicit(see below) mapping(const LayoutLeftPaddedMapping& other);
Constraints:
  • is-layout-left-padded-mapping-of<LayoutLeftPaddedMapping> is true.
  • is_constructible_v<extents_type, typename LayoutLeftPaddedMapping​::​extents_type>
    is true.
Mandates: If rank_ is greater than 1, then padding_value == dynamic_extent || LayoutLeftPaddedMapping::padding_value == dynamic_extent || padding_value == LayoutLeftPaddedMapping::padding_value is true.
  • If rank_ is greater than 1 and padding_value does not equal dynamic_extent, then other.
    stride(1)
    equals LEAST-MULTIPLE-AT-LEAST(padding_value, extents_type::index-cast(other.extent(0)))
  • 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-1 with other.stride(1).
Remarks: The expression inside explicit is equivalent to: rank_> 1 && (padding_value != dynamic_extent || LayoutLeftPaddedMapping::padding_value == dynamic_extent)
template<class LayoutRightPaddedMapping> constexpr explicit(see below) mapping(const LayoutRightPaddedMapping& other) noexcept;
Constraints:
  • is-layout-right-padded-mapping-of<LayoutRightPaddedMapping> is true or
    is-mapping-of<layout_right, LayoutRightPaddedMapping> is true.
  • rank_ equals zero or one.
  • is_constructible_v<extents_type, typename LayoutRightPaddedMapping​::​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 LayoutRightPaddedMapping::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 does not affect either the constraints or the preconditions.
— end note]