开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
G++ 4.1.3
问题(Question):
sort()
这个function是针对class的第一个成员做排序
有办法针对第二个成员吗?
程式码(Code):(请善用置底文网页, 记得排版)
class AAA
{
friend ostream &operator<<(ostream &, const AAA &);
public:
char x;
int y;
float z;
AAA();
AAA(const AAA &);
~AAA(){};
AAA &operator=(const AAA &rhs);
int operator==(const AAA &rhs) const;
int operator<(const AAA &rhs) const;
};
比如说
如果用 sort() 的话
会针对 char x 这个第一个成员作排序
有办法针对 int y做排序吗?
谢谢 另外想问说
std::list 有哪些函数可以使用哪里查的到呢?
比如 .push_front() .push_back() .merge() 等等
我在网络上查到的都是部份而已
谢谢
补充说明(Supplement):