我想知道是否有可能将一个将参数传递给比较函数的构造函数传递给一个集合。
例如这样的:
class cmp
{
private:
string args_;
public:
cmp(const string& s):args_(s){}
bool operator()(const int & a, const int& b)
return a<b;
}
int main(int argc, char * argv[])
{
string s(argv[1]);
multiset<int, cmp(s)> ms; //can i do this?
}