stblsrt2.cpp

We use cookies. Read the Privacy and Cookie Policy

stblsrt2.cpp

#include ‹stl.h›

#include ‹iostream.h›

#include ‹string.h›

bool string_less(const char* a_, const char* b_) {

 return ::strcmp(a_, b_) ‹ 0 ? 1 : 0;

}

char* letters[6] = {"bb", "aa", "ll", "dd", "qq", "cc"};

int main() {

 stable_sort(letters, letters + 6, string_less);

 for (int i = 0; i ‹ 6; i++) cout ‹‹ letters[i] ‹‹ ;

 cout ‹‹ endl;

 return 0;

}