Namespaces
Variants
Actions

std::experimental::simd<T,Abi>::size

From cppreference.com
< cpp‎ | experimental‎ | simd‎ | simd
 
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
 
SIMD library
 
std::experimental::simd
static constexpr size_t size() noexcept;
(parallelism TS v2)

Returns the width (the number of values) of simd<T, Abi>.

[edit] Example

The actual output depends on target and compiler flags.

#include <experimental/simd>
#include <cstdint>
#include <iostream>
namespace stdx = std::experimental;
 
int main()
{
    stdx::native_simd<std::int32_t> a = 1;
    std::cout << a.size() << '\n';
    std::cout << reduce(a) << '\n';
}

Possible output:

16
16

[edit] See also

(parallelism TS v2)
obtains the number of elements of a given element type and ABI tag
(class template) [edit]
[static] (parallelism TS v2)
returns the width / number of elements
(public static member function of std::experimental::simd_mask<T,Abi>) [edit]

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant