All pastes #125305 Raw Edit

Something

public cpp v1 · immutable
·published 2006-08-10 15:14 UTC
rendered paste body
bool List::InsertSorted(const DataType& data){        Node* tmp = NULL;        // No nodes in the list        if (myHead == 0 || lexicographical_compare(data.begin(), data.end(), myHead->GetData().begin(), myHead->GetData().end()))        {                myHead = new Node(data, myHead);                myCurrent = myHead;                return true;        }        for (tmp = myHead; tmp != NULL; tmp = tmp->GetNext())        {                if (lexicographical_compare(data.begin(), data.end(), tmp->GetData().begin(), tmp->GetData().end()))                {                        myCurrent = new Node(data, tmp);                        myCurrent->SetNext(tmp);                        return true;                }                tmp = tmp->GetNext();        }        tmp->SetNext(new Node(data, tmp));        return true;}