std::layout_right::mapping<Extents>::operator()
來自 cppreference.com
< cpp | 容器 | mdspan | layout_right | 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。
此過載僅在以下條件為真時參與過載決議:
- sizeof...(Indices) == extents_type::rank() 為 true,
- (std::is_convertible_v<Indices, index_type> && ...) 為 true,並且
- (std::is_nothrow_constructible_v<index_type, Indices> && ...) 為 true。
如果 extents_type::index-cast(i) 不是 extents() 中的多維索引,則行為未定義。
目錄 |
[編輯] 引數
indices | - | 底層 extents 物件中的多維索引 |
[編輯] 返回值
偏移值。
[編輯] 示例
本節不完整 原因:無示例 |
[編輯] 參閱
將多維索引對映到偏移量值 ( std::layout_left::mapping<Extents> 的公有成員函式) | |
將多維索引對映到偏移量值 ( std::layout_stride::mapping<Extents> 的公有成員函式) | |
訪問指定多維索引處的元素 ( std::mdspan<T,Extents,LayoutPolicy,AccessorPolicy> 的公有成員函式) |