I wanna pass a function argument in the constructor of the following class:
template <class T>
class Class
{
private:
bool (*fc)(T, T);
public:
template <class T>
Class(const bool(*func)(T, T))
{
}
~Class() {}
};
bool randomFunction(int a, int b)
{
return a <= b;
}
int main() {
LDI<int> test(randomFunction);
return 0;
}
Severity Code Description Project File Line Suppression State Error C2664 'Class::Class(const bool (__cdecl *)(T,T))': cannot convert argument 1 from 'bool (__cdecl *)(int,int)' to 'const bool (__cdecl *)(T,T)
Error (active) E0289 no instance of constructor "Class::Class[with T=int]" matches the argument list
How do I fix it and where's the problem?