Defined in Header
#include <eve/traits/overload.hpp>
Constants functions in EVE are built using a very common pattern. Inheriting from eve::constant_callable simplifies the implementation of such eve::callable by just requiring your eve::callable type to implement a static value member function that provides the constant value using two parameters:
- an eve::options pack containing potential decorators passed to the constant.
- an eve::as instance to specify the translated element type of the output.
Constant functions in EVE also supports masking, which is directly implemented in eve::constant_callable.
- Note
- The deferred overload named in the EVE_CALLABLE_OBJECT macro process is still available if an architecture specific implementation of any given constant is required.
- Template Parameters
-
| Func | Type of current Callable Object being implemented. |
| OptionsValues | Type of stored options. |
| Options | List of supported option specifications. |
#include <iostream>
#include <type_traits>
#include <eve/traits/overload.hpp>
#include <eve/wide.hpp>
{
template<typename Options>
{
template<typename T>
template<eve::floating_value T>
};
inline constexpr auto some_pi = functor<some_pi_t>;
};
{
std::cout << "Is Pi(as<float>) supported: "
<< std::boolalpha << std::is_invocable_v<eve::tag_t<eve::some_pi>,
eve::as<float>>
<< "\n";
std::cout << "Is Pi(float) supported: "
<< std::boolalpha << std::is_invocable_v<eve::tag_t<eve::some_pi>, float>
<< "\n";
std::cout << "Is Pi(as<wide<unsigned char>>) supported: "
<< "\n";
}
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition value.hpp:34
#define EVE_CALLABLE_OBJECT(TYPE, NAME)
Generate the generic function interface for an actual eve::callable.
Definition protocol.hpp:157
#define EVE_DISPATCH_CALL(...)
Generate the proper call to current EVE's Callable Object implementation.
Definition protocol.hpp:194
typename decltype(detail::as_translated_type(as< T >{}))::type translate_t
Returns the final translated type of T.
Definition translation.hpp:107
EVE Main Namespace.
Definition abi.hpp:19
Lightweight type-wrapper.
Definition as.hpp:29
CRTP base class giving an EVE's Callable Object the constant function semantic.
Definition constant.hpp:50
constexpr auto else_(V const &v) const
Extends a conditional expression with an alternative value.
Definition conditional.hpp:549
Conditional expression keeping all lanes between two position.
Definition conditional.hpp:528