std::experi...c_simd_cast(3)
π 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>isfalse, orV::size()issimd<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 inputsimdobject. 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
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms