It's complaining because it cannot cast a Lambda Object to a pointer to a function.
You nee to capture the function as a plain type (say X) then pass it through to another meta function to decide if its callable.
template <typename X, typename enable_if = void>
struct CallAble
{};
template <typename X>
struct CallAble
< X
, std::void_t<decltype(std::declval<X>()(std::declval<T>(), std::declval<T>())>
>
{
typedef decltype(std::declval<X>()(std::declval<T>(), std::declval<T>()) type;
};
Will only return a type if its callable, and that type is the result type.
You are going to have to shape this for your specific work.
I figured out the error by reading:
Smooth.h:63:15: error: invalid user-defined conversion from ‘...’ to ‘...’
Pretty clear actually. Something didn't cast. What is it trying to get?
short unsigned int (*)(short unsigned int, short unsigned int)
(*) is the important part. Pointer to a function.
Smooth<T, S>::sum(std::size_t) [with T = short unsigned int; long unsigned int S = 20; std::size_t = long unsigned int]::<lambda(short unsigned int, short unsigned int)>
okay ugly, whats the actual path though
Smooth<T, S>::sum(std::size_t)::<lambda(short unsigned int, short unsigned int)>
Right so a Lambda in the namespace/function Smooth<T, S>::sum(std::size_t).
Yep lambdas don't cast to function pointers.
Helps to have a text editor to cut the error information up in.