I want to define a class member std::set with function pointer as key_comp, but compiler report "is not a type".
bool compare(unsigned v1, unsigned v2)
{
...
}
std::set<unsigned, decltype(compare)*> GoodSet(compare);
class BadSet{
public:
...
std::set<unsigned, decltype<compare>*> Set2(compare);
};
int main()
{
BadSet S;
return 0;
}
GoodSet compiled OK, but GNU C++ report at BadSet: "compare is not a type". My system is windows 10 + WSL 2.0 + ubuntu 20.04.