hi all.
in my current project I use the following code to sort a set of log entries that are stored as pointers in a std::list...
MessageBox(0, stringf("before(%d).", entries.size()).c_str(), APP_NAME, MB_OK);
greater<LogFileEntry*> entry_greater;
entries.sort(entry_greater);
MessageBox(0, stringf("after (%d).", entries.size()).c_str(), APP_NAME, MB_OK);
where the functor greater is a template specialization:
struct std::greater<LogFileEntry*>
{
bool operator()(const LogFileEntry*& e0, const LogFileEntry*& e1)const
{
return e0->datetime > e1->datetime;
};
};
Unfortunately the one line that does the sorting reduces the number of list elements from over 100k to around 13k in my testing dataset.
Now the question is: WHY?
Maybe some of you can tell me...
Thanks,
Alex
[edited by - dajudge on September 22, 2003 1:56:38 PM]