E.V.E  0.1-beta

◆ operator[]() [2/3]

template<typename Type , typename Cardinal >
template<std::ptrdiff_t... I>
auto eve::wide< Type, Cardinal >::operator[] ( pattern_t< I... >  p) const
inlinenoexcept

Static lookup via lane indexing.

Generate a new eve::wide which is an arbitrary shuffling of current eve::wide lanes. ‘p’ is an instance of eve::pattern_t constructed via the eve::pattern template variable. Values appearing in the pattern must be between 0 and size()-1 or equal to eve::na_ to indicate the value at this lane must be replaced by zero or this operator will not participate in overload resolution.

Note that if the statically generated pattern matches a predefined Shuffling and Swizzling function the corresponding optimized shuffling functions will be called.

Parameters
pA eve::pattern defining a shuffling pattern
Returns
A wide constructed as wide{ get(I), ... }.
See also
eve::pattern_t
eve::pattern

Example:

See it live on Compiler Explorer

#include <eve/wide.hpp>
#include <iostream>
int main()
{
eve::wide<int, eve::fixed<8>> r{1, 2, 4, 8, 16, 32, 64, 128};
std::cout << r << "\n";
// Reindex r with a static pattern
std::cout << r[ eve::pattern<0,0,1,1,2,2,3,3> ] << "\n";
}
Wrapper for SIMD registers.
Definition: wide.hpp:65