Description: The STL library comes with the Fuck VC6. Question: struct test {test (int _nIndex): nindex (_nIndex) {} int NINDEX;}; list #include
Struct test {test (int _nIndex = 0) {nindex = _nIndex;} int nindex;
Class test_ptr {public: test_ptr (): PTR_ (0) {} test_ptr (TEST * P): PTR_ (P) {} public: BOOL Operator <(const test_ptr & x) const {return PTR_-> NINDEX
List
Void Print () {list
INT main () {alist.push_back (new test (15)); alist.push_back (new test (6)); alist.push_back (new test (32));
Print (); alist.sort (); print (); return 0;}, two, make a sorting interface. At first I used this method. But he cannot compile it under VC. // In DEV C via #include using namespace std;
Struct test {test (int _nIndex = 0) {nindex = _nIndex;} int nindex;
Class test_ptr_comp {public: BOOL Operator () (const test * const & x, const test * const & y) const {return x-> nindex
List
Void Print () {list INT main () {alist.push_back (new test (15)); alist.push_back (new test (6)); alist.push_back (new test (18)); print (); alist.sort (Test_ptr_comp ()) PRINT (); System ("pause"); Return 0;} The Sort function under the VC can only support Greater's comparison interface. Fucking ~~ The first method feels very unfriendly, and every time it takes things through Wrapper. I plan to use Sort to serve serial data. Ready to play SP6, replace the library.