E.V.E  0.1-beta

◆ logical()

template<typename Type , typename Cardinal >
template<std::invocable< size_type, size_type > Generator>
eve::logical< wide< Type, Cardinal > >::logical ( Generator &&  g)
inlinenoexcept

Constructs a eve::logical from a Callable Object.

The Callable Object must satisfy the following prototype:

T generator(std::ptrdiff_t index, std::ptrdiff_t cardinal);


and is supposed to return the value computed from the current index and the cardinal to store at said index.

Parameters
gThe Callable Object to use as a value generator

Example:

See it live on Compiler Explorer

#include <eve/logical.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
// Generates the wide [true false true .. ]
eve::logical<eve::wide<int>> r = [](auto i, auto) { return i%2 == 0;};
std::cout << r << "\n";
}
Wrapper for SIMD compatible logical types.
Definition: logical.hpp:36