1
任何人都可以说明为什么这个函数对象不需要指定的类型吗?为什么这个函数对象不需要指定?
class StringPtrTmplLess
{
public:
template<typename PtrType>
bool operator()(const PtrType * lhs, const PtrType * rhs)
{
return *lhs < *rhs;
}
};
int main()
{
set<string*, StringPtrTmplLess> s2;
return 0;
}
编译器如何知道它将初始化StringPtrTmplLess的指定类型?