std::experimental::simd_mask<T,Abi>:: operator[]
From cppreference.com
<
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) |
The subscript operators allow reading and writing single elements of a
simd_mask
.
1)
Returns a reference proxy to the i-th element. This proxy type should not be captured into an lvalue. Lvalues of
simd_mask::reference
can only convert to
value_type
. Rvalues of
simd_mask::reference
overload assignment and all compound assignment operators as well as
swap
.
2)
Returns a prvalue of the i-th element. In contrast to containers, which contain objects of type
value_type
, a
simd_mask
is not a container of individual objects and therefore cannot return an lvalue-reference.
Parameters
| i | - |
the element index. Required to be less than
size()
|
Example
Run this code
#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'; }
Possible output:
1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Retrieved from "
https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/simd/simd_mask/operator_at&oldid=159780
"