, :
template <typename T, typename Func>
void Foo( const concurrency::array_view<const T>& avParam, Func f )
int f(int x) restrict(amp) {return x+2;}
then try:
Foo( avParam, [](int x) restrict(amp){ return f(x); } );`
which, instead of a function pointer, finstead creates a lambda that does not use a function pointer.
We can automate this
#define AMP_OVERLOAD_SET(F) struct { \
template<typename... Args> auto operator()(Args&&...args)const restrict(amp) \
->decltype( F(std::declval<Args>()...) ) \
{ return F( std::forward<Args>(args)... ); } \
}
static AMP_OVERLOAD_SET(f) amped_f;
Foo( vParam, amped_f );
which may or may not work.
source
share