[mdspan.layout.leftpad.cons] (original) (raw)
23 Containers library [containers]
23.7 Views [views]
23.7.3 Multidimensional access [views.multidim]
23.7.3.4 Layout mapping [mdspan.layout]
23.7.3.4.8 Class template layout_left_padded::mapping [mdspan.layout.leftpad]
23.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 andpadding_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 andpadding_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 andpadding_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 andpadding_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 withother.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, thenpadding_value == dynamic_extent ||LayoutLeftPaddedMapping::padding_value == dynamic_extent ||padding_value == LayoutLeftPaddedMapping::padding_valueis true.
- If rank_ is greater than 1 andpadding_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_]