I wanted to create these function templates you see below. Their purpose is to compare functors, but I needed to cover a special case for the boost.bind type of functors.
template<typename R, typename F, typename L>
void compare(boost::_bi::bind_t<R, F, L>& lhs, boost::_bi::bind_t<R, F, L>& rhs)
{
std::cout << lhs.compare(rhs) << std::endl;
}
template<typename T>
void compare(T lhs, T rhs)
{
std::cout << (lhs == rhs) << std::endl;
}
The problem is that when I do compare(boost::bind(func, 1), boost::bind(func, 1))
, the compiler tries to use the second template. If I comment out the second one, it will correctly use the one specialized for the boost.bind type and everything will work fine.
How can I make it choose the correct function template to use?