typedef function is not a type name?
问题 This is my code inside myCode.h : #include <set> using namespace std; bool MyObjectComp(const MyObject& lhs, const MyObject& rhs) { return lhs.mTick < rhs.mTick; } typedef std::multiset<MyObject, MyObjectComp> MyObjectMultiSet; but it says that function MyObjectComp is not a type name. Where should I place it? 回答1: The template parameter for std::multiset expects a type, MyObjectComp is not a type but is instead a function name. You can either use decltype to get its type like typedef std: