std::experimental::simd<T,Abi>::operator++, std::experimental::simd<T,Abi>::operator--
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
| Parallel exceptions | ||||
| Additional execution policies | ||||
| Algorithms | ||||
| Task blocks | ||||
| Data-parallel vectors | ||||
SIMD library
std::experimental::simd
| Member functions | |||||||||||||||||
| |||||||||||||||||
| Non-member functions | |||||||||||||||||
| simd& operator++() noexcept; |
(1) | (parallelism TS v2) |
| simd operator++( int ) noexcept; |
(2) | (parallelism TS v2) |
| simd& operator--() noexcept; |
(3) | (parallelism TS v2) |
| simd operator--( int ) noexcept; |
(4) | (parallelism TS v2) |
Applies the increment or decrement operator on each element of the simd.
1) Increments all values in the
simd by 1 and returns a reference to itself.2) Increments all values in the
simd by 1 and returns a copy of itself before the operation.3) Decrements all values in the
simd by 1 and returns a reference to itself.4) Decrements all values in the
simd by 1 and returns a copy of itself before the operation.[edit] Example
Run this code
#include <cstddef> #include <experimental/simd> #include <iostream> namespace stdx = std::experimental; void print(auto rem, auto const& a) { std::cout << rem << ": "; for (std::size_t i{}; i != std::size(a); ++i) std::cout << a[i] << ' '; std::cout << '\n'; } int main() { stdx::native_simd<int> p = -2; print('p', p); ++p; print('p', p); auto q = p--; print('p', p); print('q', q); }
Possible output:
p: -2 -2 -2 -2 p: -1 -1 -1 -1 p: -2 -2 -2 -2 q: -1 -1 -1 -1