std::extents<IndexType,Extents...>:: extents
|
constexpr
extents
(
)
=
default
;
|
(1) | (自 C++23 起) |
|
template
<
class
OtherIndexType,
std::
size_t
...
OtherExtents
>
constexpr
explicit
(
/*见下文*/
)
|
(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
(
)
)
|
(4) | (自 C++23 起) |
|
template
<
class
OtherIndexType,
std::
size_t
N
>
constexpr
explicit
(
N
!
=
rank_dynamic
(
)
)
|
(5) | (自 C++23 起) |
构造一个
extents
对象。可以通过仅包含动态维度的方式构建
extents
(此时所有数值均被存储),也可以通过包含所有维度的方式构建(此操作存在前置条件)。
extents
对象进行转换。构造后,
*
this
==
other
为
true
。
- 如果满足以下任一条件,则行为未定义:
-
- 对于任意满足 static_extent ( r ) 表示静态维度的 r ,存在 other. extent ( r ) ! = static_extent ( r ) ,或
- 对于 other 中的任意维度值 r , other. extent ( r ) 无法表示为 IndexType 类型的值。
- 此重载仅当满足以下条件时参与重载决议:
-
- sizeof... ( OtherExtents ) == rank ( ) 为 true ,且
-
(
(
OtherExtents
==
std::
dynamic_extent
||
Extents
==
std::
dynamic_extent
||
OtherExtents == Extents ) && ... ) 为 true 。
- 此构造函数在以下情况下为 explicit :
-
- ( ( Extents ! = std:: dynamic_extent && OtherExtents == std:: dynamic_extent ) || ... ) 为 true ,或
- std:: numeric_limits < IndexType > :: max ( ) < std:: numeric_limits < OtherIndexType > :: max ( ) 为 true 。
- 此重载仅当以下条件满足时参与重载决议:
-
- ( std:: is_convertible_v < OtherIndexTypes, IndexType > && ... ) 为 true ,
- ( std:: is_nothrow_constructible_v < IndexType, OtherIndexTypes > && ... ) 为 true ,且
- N == rank_dynamic ( ) || N == rank ( ) 为 true 。
- 若满足以下任一条件则行为未定义:
-
- 当 N ! = rank_dynamic ( ) 时,存在维度 r 满足 static_extent ( r ) 表示静态维度,但 exts_arr [ r ] 不等于 static_extent ( r ) ,或
- exts 中的元素为负值或无法表示为 IndexType 类型的值。
[
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
]
进行直接非列表初始化。
- 此重载仅在以下条件满足时参与重载决议:
-
- std:: is_convertible_v < const OtherIndexType & , IndexType > 为 true ,
- std:: is_nothrow_constructible_v < IndexType, const OtherIndexType & > 为 true ,且
- N == rank_dynamic ( ) || N == rank ( ) 为 true 。
- 若满足以下任一条件则行为未定义:
-
- N ! = rank_dynamic ( ) 且对于任意存在静态维度的 r , exts [ r ] 不等于 static_extent ( r ) ,或
- 对于任意维度索引 r , exts [ r ] 为负值或无法表示为 IndexType 类型的值。
参数
| other | - |
要转换的另一个
extents
|
| exts | - | 表示维度的范围 |
示例
|
本节内容不完整
原因:缺少示例 |
参见
|
|||