Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

CString Compare

TrufauxTrufaux Member Posts: 7
Hello,

I have a linked list of CStrings that I'm having trouble auto-ordering. What follows is my function:

[code]BOOL OrderedList::PushIfUnique(CString sData)
{
ListNode *pLastBefore;

//Find the last node that would precede the input in an ordered list.
for (pLastBefore = this->p; (pLastBefore->next != NULL); pLastBefore = pLastBefore->next)
if ((pLastBefore != this->p) && (pLastBefore->data.Compare(sData) > 0)) break;

//If the preceding node equals the the input, return false.
if (pLastBefore->data.Compare(sData) == 0)
return false;

//Otherwise, insert the input after the preceding node...
this->InsertAfter(sData, pLastBefore);

//..and return true.
return true;

}[/code]

The result is an unsorted list, and when I do a quick watch of the compare statement, I get "Error: argument does not match a function."

Any ideas? Thank you in advance.

trufaux

Comments

Sign In or Register to comment.