template<template< typename > class Func, typename OptionsValues, typename... Options>
struct eve::callable< Func, OptionsValues, Options >
Defined in Header
#include <eve/traits/overload.hpp>
All EVE Callable Object use a similar protocol to find and call proper architecture or type specific implementation. This protocol includes options checks and management and proper level of error reporting. eve::callable is the most general base class for defining such a Callable Object without having to manually handles all these details.
- 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>
struct func_t :
callable<func_t, Options>
{
template<eve::integral_value T>
EVE_FORCEINLINE void operator()(float) const = delete;
};
inline constexpr auto func = functor<func_t>;
};
namespace eve::detail
{
auto func_(
EVE_REQUIRES(cpu_), eve::callable_options
auto const&,
double x) {
return 1./x; }
}
int main()
{
std::cout << eve::func(8) << "\n";
std::cout << eve::func(25.) << "\n";
std::cout << "Is func(double) supported : "
<< std::boolalpha << std::is_invocable_v<eve::tag_t<eve::func>, double>
<< "\n";
std::cout << "Is func(float) supported : "
<< std::boolalpha << std::is_invocable_v<eve::tag_t<eve::func>, float>
<< "\n";
std::cout << "Is func(wide<float>) supported: "
<< std::boolalpha << std::is_invocable_v<eve::tag_t<eve::func>,
eve::wide<float>>
<< "\n";
}
The concept integral_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition: value.hpp:46
#define EVE_CALLABLE_OBJECT(TYPE, NAME)
Generate the generic function interface for an actual eve::callable.
Definition: protocol.hpp:131
#define EVE_REQUIRES(ARCH)
Flag a function to support delayed calls on given architecture.
Definition: protocol.hpp:171
#define EVE_DISPATCH_CALL(...)
Generate the proper call to current EVE's Callable Object implementation.
Definition: protocol.hpp:148
EVE Main Namespace.
Definition: abi.hpp:18
CRTP base class defining an EVE's Callable Object.
Definition: default_behaviors.hpp:53
Wrapper for SIMD registers.
Definition: wide.hpp:71