std::experi...c_simd_cast(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– simd_cast & static_simd_cast πŸ’–

okay bestie, this is the std::experi...c_simd_cast(3) page from the C++ Standard Libary manual. We're talking about std::experimental::simd_cast,std::experimental::static_simd_cast, and they're here to cast your simd objects with main character energy ✨. Let's get into it 🫢.


🌸 NAME 🌸

std::experimental::simd_cast,std::experimental::static_simd_cast β€” aka std::experimental::simd_cast,std::experimental::static_simd_cast. Yes bestie, the NAME section said it twice, and we're honoring it πŸ’….


✨ Synopsis ✨

Defined in header <experimental/simd>:

template< class V, class T, class Abi >                      (1)
(parallelism TS v2)
/*see below*/ simd_cast( const simd<T, Abi>& v ) noexcept;
template< class V, class T, class Abi >
/*see below*/ static_simd_cast( const simd<T, Abi>& v )      (2)
(parallelism TS v2)
noexcept;

so what's the vibe? Cast a simd object to another simd object. If V is T, returns simd<T, Abi>; otherwise, if V is a scalar type, returns simd<V, simd_abi::fixed_size<simd<T, Abi>::size()>>. Otherwise, V must be a simd type, and the function returns V.

1) This function does not participate in overloading resolution unless:

  • every possible value of the input element can be represented with the output element,
  • either is_simd_v<V> is false, or V::size() is simd<T, Abi>::size().

2) This function does not participate in overloading resolution unless either is_simd_v<V> is false, or V::size() is simd<T, Abi>::size().


πŸŽ€ Parameters πŸŽ€

  • v β€” the input simd object. That's the whole parameter list, and she's serving input bestie realness πŸ’–.

πŸ¦‹ Return value πŸ¦‹

A simd object with the i-th element initialized to static_cast<To>(v[i]), where To is the output element type as specified. slay ✨.


🌈 Notes 🌈

The TS specification is missing simd_cast and static_simd_cast overloads for simd_mask. The libstdc++ implementation provides the missing overloads in the std::experimental::__proposed namespace. If you already use the

namespace stdx = std::experimental;

shortcut, you might be interested to use

namespace stdx {
  using namespace std::experimental;
  using namespace std::experimental::__proposed;
}

instead. Alternatively, libstdc++ implements a __cvt() member function in simd_mask, which allows implicit conversion of the mask. See also: https://github.com/VcDevel/std-simd/issues/41


🌸 Example 🌸

This section is incomplete. Reason: no example. 😭 no example bestie, we're just vibing with the todo.


πŸ’… Category: πŸ’…

  • Todo no example

mwah πŸ’‹ this cutie came from source http://cppreference.com, version/date 2024.06.10, and the page is std::experi...c_simd_cast(3). bye bestie, go cast something cute πŸ«ΆπŸ’–

πŸ“¦ where this page comes from