std::experimental::simd_mask<T,Abi>:: operator[]
From cppreference.net
<
cpp
|
experimental
|
simd
|
simd mask
C++
Experimental
| Technical Specification | ||||
| Filesystem library (filesystem TS) | ||||
| Library fundamentals (library fundamentals TS) | ||||
| Library fundamentals 2 (library fundamentals TS v2) | ||||
| Library fundamentals 3 (library fundamentals TS v3) | ||||
| Extensions for parallelism (parallelism TS) | ||||
| Extensions for parallelism 2 (parallelism TS v2) | ||||
| Extensions for concurrency (concurrency TS) | ||||
| Extensions for concurrency 2 (concurrency TS v2) | ||||
| Concepts (concepts TS) | ||||
| Ranges (ranges TS) | ||||
| Reflection (reflection TS) | ||||
| Mathematical special functions (special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
Extensions for parallelism v2
| Parallel exceptions | ||||
| Additional execution policies | ||||
| Algorithms | ||||
| Task blocks | ||||
| Data-parallel vectors | ||||
SIMD library
std::experimental::simd_mask
| Member functions | ||||||||||||
|
||||||||||||
| Non-member functions | ||||||||||||
|
reference operator
[
]
(
size_t i
)
;
|
(1) | (parallelism TS v2) |
|
bool
operator
[
]
(
size_t i
)
const
;
|
(2) | (parallelism TS v2) |
添字演算子は、
simd_mask
の単一要素の読み取りと書き込みを可能にします。
1)
i番目の要素への参照プロキシを返します。このプロキシ型は左辺値としてキャプチャすべきではありません。
simd_mask::reference
の左辺値は
value_type
へのみ変換可能です。
simd_mask::reference
の右辺値は代入演算子、すべての複合代入演算子、および
swap
をオーバーロードします。
2)
i番目の要素のprvalueを返します。型
value_type
のオブジェクトを含むコンテナとは対照的に、
simd_mask
は個々のオブジェクトのコンテナではないため、lvalue-referenceを返すことはできません。
パラメータ
| i | - |
要素インデックス。
size()
未満であることが要求されます
|
例
このコードを実行
#include <cstddef> #include <experimental/simd> #include <iostream> namespace stdx = std::experimental; int main() { stdx::native_simd_mask<int> a{true}; a[1] = 0; for (std::size_t i = 0; i != a.size(); ++i) std::cout << a[i] << ' '; std::cout << '\n'; }
出力例:
1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1