Hey just a quick question with list <Object*> object;

when i put an object in the container i use

object.push_front(new thing(param1,param2,param3,param4,param5));

because i have used new how do i go about deleting this certain object in the list i figured somthing like this

while(p != object.end()) 
	   delete *p; // delete allocated in the list

p is also declared as list<Object*>::iterator p; and has been assigned to begin()
basicly i want to delete from the list when the user has enterd somthing for param so say param is an int and user enters param = 1 then delete list that has param == 1
thats what exist does btw it just returns true where the object has param == 1
this is in c++ btw.

dont worry i figured it out

		 delete object.front();

etc that was finaly clean up but i use same code just pushed the object i found to the front then delete + poped it off thxs

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.