std::experi...:operator[](3)
π
std::experi...:operator[](3) π
okay bestie, welcome to the C++ Standard Libary page for std::experi...:operator[](3) β yes, βLibaryβ is literally how the manual name is spelled, and we are respecting it, no cap πβ¨
πΈ NAME πΈ
std::experimental::simd_mask::operator[] - std::experimental::simd_mask::operator[]
β¨ Synopsis β¨
reference operator[]( size_t i ); (1) (parallelism TS v2)
bool operator[]( size_t i ) const; (2) (parallelism TS v2)
The subscript operators let you read and write single elements of a simd_mask. Iconic behavior, honestly π«Ά
- Returns a reference proxy to the
i-th element. This proxy type should not be captured into an lvalue. Lvalues ofsimd_mask::referencecan only convert tovalue_type. Rvalues ofsimd_mask::referenceoverload assignment and all compound assignment operators as well asswap. - Returns a prvalue of the
i-th element. In contrast to containers, which contain objects of typevalue_type, asimd_maskis not a container of individual objects and therefore cannot return an lvalue-reference. Thatβs just the vibe check itβs giving π
π Parameters π
iβ the element index. Required to be less thansize().
π¦ 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
made with π by the C++ standard library girlies β source: http://cppreference.com, version/date: 2024.06.10, page: std::experi...:operator[](3) π«Άπ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms