Namespaces
Variants

std::extents<IndexType,Extents...>:: extents

From cppreference.net
constexpr extents ( ) = default ;
(1) (自 C++23 起)
template < class OtherIndexType, std:: size_t ... OtherExtents >

constexpr explicit ( /*见下文*/ )

extents ( const std:: extents < OtherIndexType, OtherExtents... > & other ) noexcept ;
(2) (自 C++23 起)
template < class ... OtherIndexTypes >
constexpr explicit extents ( OtherIndexTypes... exts ) noexcept ;
(3) (自 C++23 起)
template < class OtherIndexType, std:: size_t N >

constexpr explicit ( N ! = rank_dynamic ( ) )

extents ( std:: span < OtherIndexType, N > exts ) noexcept ;
(4) (自 C++23 起)
template < class OtherIndexType, std:: size_t N >

constexpr explicit ( N ! = rank_dynamic ( ) )

extents ( const std:: array < OtherIndexType, N > & exts ) noexcept ;
(5) (自 C++23 起)

构造一个 extents 对象。可以通过仅包含动态维度的方式构建 extents (此时所有数值均被存储),也可以通过包含所有维度的方式构建(此操作存在前置条件)。

1) 默认构造函数。将所有动态维度初始化为零。
2) 从另一个 extents 对象进行转换。构造后, * this == other true
  • 如果满足以下任一条件,则行为未定义:
  • 对于任意满足 static_extent ( r ) 表示静态维度的 r ,存在 other. extent ( r ) ! = static_extent ( r ) ,或
  • 对于 other 中的任意维度值 r other. extent ( r ) 无法表示为 IndexType 类型的值。
  • 此重载仅当满足以下条件时参与重载决议:
  • 此构造函数在以下情况下为 explicit
3) N sizeof... ( exts ) exts_arr std:: array < IndexType, N > { static_cast < IndexType > ( std :: move ( exts ) ) ... } ,等价于 extents ( exts_arr )
  • 此重载仅当以下条件满足时参与重载决议:
  • 若满足以下任一条件则行为未定义:
  • N ! = rank_dynamic ( ) 时,存在维度 r 满足 static_extent ( r ) 表示静态维度,但 exts_arr [ r ] 不等于 static_extent ( r ) ,或
  • exts 中的元素为负值或无法表示为 IndexType 类型的值。
4,5) N 等于 rank_dynamic ( ) ,则对于 [ 0 , rank_dynamic ( ) ) 范围内的所有 d ,使用 std:: as_const ( exts [ d ] ) dynamic-extents [ d ] 进行直接非列表初始化。否则,对于 [ 0 , rank_dynamic ( ) ) 范围内的所有 d ,使用 std:: as_const ( exts [ dynamic-index-inv ( d ) ] ) dynamic-extents [ d ] 进行直接非列表初始化。
  • 此重载仅在以下条件满足时参与重载决议:
  • 若满足以下任一条件则行为未定义:
  • N ! = rank_dynamic ( ) 且对于任意存在静态维度的 r exts [ r ] 不等于 static_extent ( r ) ,或
  • 对于任意维度索引 r exts [ r ] 为负值或无法表示为 IndexType 类型的值。

参数

other - 要转换的另一个 extents
exts - 表示维度的范围

示例

参见