禁止stl中map set自动排序

1
2
3
4
5
6
7
8
9
10
template<class T>
struct DisableCompare :public std::binary_function<T,T,bool>
{
bool ()(T lhs,T rhs) const
{

return true;
}
};

std::map<int,string,DisableCompare<int> > sMap;