命名空间
变体
操作

std::layout_stride::mapping<Extents>::operator()

来自 cppreference.cn
< cpp‎ | 容器‎ | mdspan‎ | layout_stride‎ | mapping
 
 
 
 
 
template< class... Indices >
constexpr index_type operator()( Indices... indices ) const noexcept;
(C++23 起)

将多维索引 indices 映射到偏移值。

等价于 return ((static_cast<index_type>(indices) * stride(P)) + ... + 0);,其中 P 是一个包,使得 std::is_same_v<std::index_sequence_for<Indices...>, std::index_sequence<P...>>true

此重载仅在以下条件为真时参与重载决议:

如果 extents_type​::index-cast(i) 不是 extents() 中的多维索引,则行为未定义。

目录

[编辑] 参数

indices - 底层 extents 对象中的多维索引

[编辑] 返回值

偏移值。

[编辑] 示例

[编辑] 另请参阅

将多维索引映射到偏移量值
(std::layout_left::mapping<Extents> 的公共成员函数) [编辑]
将多维索引映射到偏移量值
(std::layout_right::mapping<Extents> 的公共成员函数) [编辑]
访问指定多维索引处的元素
(std::mdspan<T,Extents,LayoutPolicy,AccessorPolicy> 的公共成员函数) [编辑]