I'm making a template class, that requires an std::set, it's working perfectly, until I pass a Compare class with it.
test.h
class test
{
std::set<T> s;
public:
test(std::set<T>&) ;
....
}
test.cpp
std::set<std::string, std::less<std::string> > a;
test<std::string> x(a)
I can't get my head wrapped around how to pass the function and how to use it at test.h.
Edit: The error that I'm getting is
error: no matching function for call to 'test<std::__cxx11::basic_string<char> >::test(std::set<std::__cxx11::basic_string<char>, std::less<std::string>>&)'
test<std::string> x( a );
I tried to make a constructor that ask for a function too but:
test(std::set<T, bool (*f)(T, T)>&);
, then I got another error, that I can't use f as a function