I have something this:
template
class Image {
Image(int w, int h, T defaultVal){
for(int i=0; i
You're looking for std::is_invocable:
template<typename F, typename = std::enable_if_t<
std::is_invocable<F&, int, int>>
F&
because you're invoking it as an lvalue, and then after that it's just a list of types of parameters.
The above requires C++17. It is implementable on C++14, but in your case we can also take a much simpler approach and just do:
template <typename F, typename = decltype(std::declval<F&>()(1, 1))>
F&
for the same reason as above, and the rest of the expression is more familiar. Since we're calling with int
s we don't care about the other things that INVOKE
allows for (e.g. pointers to members).