367.md

February 15, 2024 ยท View on GitHub

Info

  • Did you know about C++26 simd proposal (1/N)?

    • https://wg21.link/P1928

Example

#include <experimental/simd>

int main() {
    std::experimental::simd<int> s{};
    s = 1;

    for (auto i = 0; i < std::size(s); ++i) {
        std::print("{}", int(s[i])); // prints 1111 (depending on the arch)
    }
}

https://godbolt.org/z/7dhGs7Mz3

Puzzle

  • **Can you show use cases for all simd constructors?
// TODO simd constructors

https://godbolt.org/z/M8EKbozEe

Solutions