Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot figure how to compact an array of pointers

Status
Not open for further replies.

Christi444

Technical User
Aug 6, 2001
3
US
I am trying to figure out how to go about compacting an array of pointers within a method. I have two classes (eg. Book and Book Library) The array is an array of pointers called bl of type Book and is initialized and declared in the Book Library class. I have tried to attempt using a for loop and erasing the entry with the specified criteria but when ever I try sl.erase(i,1) and then proceed, I get an error. Does any one know how I can go about deleting various entries (compacting the array)

bool Book :: compactArray()
{
for(int i=0; i < anarbitrarysize ; i--) //forloop
{

if(sl->getCheckoutstatus()== false)

{
--------THE PROBLEM-------
//I want to eliminate every instance from the
//array that is false
}
}
}
THANK U :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top