◆ swap_if()
template<logical_value Mask, value Value>
Conditional swap. Required header: Swaps the SIMD values
ExampleSee it live on Compiler Explorer #include <eve/function/swap_if.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
eve::wide<float, eve::fixed<4>> a = {1.2f, 3.4f, 5.6f, 7.8f};
eve::wide<float, eve::fixed<4>> b = {0.1f,1e-2f,1e-3f,1e-4f};
std::cout << "Before swap_if(a < 4.f,a,b)\n"
<< "<- a = " << a << '\n'
<< "<- b = " << b << '\n'
<< "<- a < 4.f = " << (a < 4.f) << "\n\n";
eve::swap_if(a < 4.f,a,b);
std::cout << "After swap_if(a < 4.f,a,b)\n"
<< "-> a = " << a << '\n'
<< "-> b = " << b << '\n';
return 0;
}
void swap_if(Mask const &mask, Value &lhs, Value &rhs) noexcept Conditional swap. Definition: swap_if.hpp:37 |