Skip to content

Commit

Permalink
Added looseList() method to linkList
Browse files Browse the repository at this point in the history
Sometimes someone else wants to take over a linkList's list of nodes. When and if this is the case, calling looseList() will make the linList object set its list pointer to NULL effectivly cutting ties to its list of nodes. Very handy for sorting and shuffleling nodes using two linkList objects.
  • Loading branch information
leftCoast committed Sep 26, 2020
1 parent 8982b34 commit e45ab41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lists.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ void linkList::sort(bool ascending) {
}


// Someone has taken control of our list. Just let it go.
void linkList::looseList(void) { theList = NULL; }



// ********** stack ****************
// Your basic stack. Mostly pass throughs with the usual names.

Expand Down
1 change: 1 addition & 0 deletions lists.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class linkList {
int getCount(void);
linkListObj* getByIndex(int index);
int findIndex(linkListObj* present); // returns -1 if NOT found.
void looseList(void); // Someone has taken control of our list, let it go.

protected :
linkListObj* theList;
Expand Down

0 comments on commit e45ab41

Please sign in to comment.