std::experimental::simd_mask<T,Abi>::simd_mask
From cppreference.com
 
 
 < cpp | experimental | simd | simd mask 
 
 
 C++ 
 Feature test macros (C++20)
 Concepts library (C++20)
 Metaprogramming library (C++11)
 Ranges library (C++20)
 Filesystem library (C++17)
 Concurrency support library (C++11)
 Execution control library (C++26)
Experimental 
 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)
Extensions for parallelism v2 
   
 Parallel exceptions
 Additional execution policies
 Algorithms
 Task blocks
std::experimental::simd_mask 
 Member functions
 Non-member functions
simd_mask() noexcept = default;
 (1) 
 (parallelism TS v2) 
explicit simd_mask( bool value ) noexcept;
 (2) 
 (parallelism TS v2) 
template< class U >
simd_mask( const simd_mask<U, simd_abi::fixed_size<size()>>& other ) noexcept;
 (3) 
 (parallelism TS v2) 
simd_mask( const simd_mask<U, simd_abi::fixed_size<size()>>& other ) noexcept;
template< class U, class Flags >
simd_mask( const bool* mem, Flags flags );
 (4) 
 (parallelism TS v2) 
simd_mask( const bool* mem, Flags flags );
simd_mask( const simd_mask& other ) noexcept = default;
 (5) 
 (parallelism TS v2) (implicitly declared)
simd_mask( simd_mask&& other ) noexcept = default;
 (6) 
 (parallelism TS v2) (implicitly declared)
1) Constructs a 
simd_mask using default initialization (constructed without initializer) or value initialization (constructed with an empty initializer).2) The broadcast constructor constructs a 
simd_mask with all values initialized to value.3) Constructs a 
simd_mask where the i-th element is initialized to other[i] for all i in the range of [0, size() ). This overload participates in overload resolution only if Abi is simd_abi::fixed_size<size()>.4) The load constructor constructs a 
simd_mask where the i-th element is initialized to mem[i] for all i in the range of [0, size() ).5,6) Implicitly declared copy and move constructors. Constructs a 
simd_mask where each element is initialized from the values of the elements in other.[edit] Parameters
 value
 -
 the value used for initialization of all 
simd_mask elements
 other
 -
 another 
simd_mask to copy from
 mem
 -
 a pointer into an array where 
[mem, mem + size()) is a valid range
 flags
 -
 if of type vector_aligned_tag, the load constructor may assume 
mem to point to storage aligned by memory_alignment_v<simd_mask>
 Type requirements
 -
is_simd_flag_type_v<Flags> must be true.
[edit] Example
Run this code
#include <algorithm> #include <cstddef> #include <experimental/simd> #include <iostream> namespace stdx = std::experimental; int main() { [[maybe_unused]] stdx::native_simd_mask<int> a; // uninitialized stdx::native_simd_mask<int> b(true); // all elements initialized with true stdx::native_simd_mask<int> c{}; // all elements initialized with false alignas(stdx::memory_alignment_v<stdx::native_simd_mask<int>>) std::array <bool, stdx::native_simd_mask<int>::size() * 2> mem = {}; std::ranges::generate (mem, [i{0}] mutable -> bool { return i++ & 1; }); stdx::native_simd_mask<int> d(&mem[0], stdx::vector_aligned); // {0, 1, 0, 1, ...} stdx::native_simd_mask<int> e(&mem[1], stdx::element_aligned); // {1, 0, 1, 0, ...} const auto xored = b ^ c ^ d ^ e; for (std::size_t i{}; i != xored.size(); ++i) std::cout << xored[i] << ' '; std::cout << '\n'; }
Possible output:
0 0 0 0 0 0 0 0
[edit] See also
(parallelism TS v2)
(class) [edit]
(parallelism TS v2)
(class) [edit]
(parallelism TS v2)
(class template) [edit]