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::multiset<MyObject, decltype(MyObjectComp)*> MyObjectMultiSet;
Or you could specify the type yourself like
typedef std::multiset<MyObject, bool(*)(const MyObject&, const MyObject&)> MyObjectMultiSet;
Also note the generally a functor/lambda is more efficent than using a function as the compiler can more easily optimize the code. I would suggest using
struct MyObjectComp {
bool operator()(const MyObject& lhs, const MyObject& rhs) {
return lhs.mTick < rhs.mTick;
}
};
typedef std::multiset<MyObject, MyObjectComp> MyObjectMultiSet;
or
auto MyObjectComp = [](const MyObject& lhs, const MyObject& rhs) {
return lhs.mTick < rhs.mTick;
};
typedef std::multiset<MyObject, decltype(MyObjectComp)> MyObjectMultiSet;