std::extents<IndexType,Extents...>::extents
来自cppreference.com
| |
(1) | (C++23 起) |
| |
(2) | (C++23 起) |
| |
(3) | (C++23 起) |
| |
(4) | (C++23 起) |
| |
(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类型的值。
- 对于
- 此重载只有在
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。
3) 令
N 为 sizeof...(exts),并令 exts_arr 为 std::array<IndexType, N>{static_cast<IndexType>(std::move(exts))...},此函数等价于 extents(exts_arr)。
- 此重载只有在
(std::is_convertible_v<OtherIndexTypes, IndexType> && ...)为true,(std::is_nothrow_constructible_v<IndexType, OtherIndexTypes> && ...)为true,并且N == rank_dynamic() || N == rank()为true时才会参与重载决议。
- 以下条件下行为未定义:
N != rank_dynamic(),且对于static_extent(r)表示静态尺度的任何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]。
- 此重载只有在
std::is_convertible_v<const OtherIndexType&, IndexType>为true,std::is_nothrow_constructible_v<IndexType, const OtherIndexType&>为true,并且N == rank_dynamic() || N == rank()istrue时才会参与重载决议。
- 以下条件下行为未定义:
N != rank_dynamic(),且对于static_extent(r)表示静态尺度的任何r,exts[r]不等于static_extent(r),或者- 对于任何秩索引
r,exts[r]为负值或不能表示为IndexType类型的值。
参数
| other | - | 要从之转换的另一 extents
|
| exts | - | 表示各尺度 |
示例
| 本节未完成 原因:暂无示例 |
参阅
| |||