map的key要求是copyable和comparable,
typedef struct stabc
{
int a;
int b;
int c;
bool operator < (const struct stabc stABCComp )const
{
return (a!= stABCComp .a) ? (a< stABCComp .a) :
(b!= stABCComp .b) ? (b< stABCComp .b) :
(c< stABCComp .c);
}
}StABC;
inline bool operator< (const T& Left, const T& Right)
{
return
(Left.a != Right.a) ? (Left.a < Right.a) :
(Left.b != Right.b) ? (Left.b < Right.b) :
(Left.c < Right.c);
}
参考连接:
http://topic.csdn.net/u/20071102/10/86602ffb-89a2-44d0-8c30-8d91be728b4b.html