Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > stl::list modif...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 14 Topic 43958 of 47563
Post > Topic >>

stl::list modified erase

by Philip Mueller <me@[EMAIL PROTECTED] > Mar 17, 2008 at 10:52 PM

Hi,

I am using multiple stl::list s of different types.

Now I want to write a function

list<type>::iterator s_erase(list<type> l, list<type>::iterator it)

that takes an iterator and deletes the element it is pointing add, and 
returns the iterator pointing to the predecessor of the erased element.

like this:

return l.erase(it)--;

But I want this to work for any contained type. For clarification:
I have theses lists:

list<c****p> ****ps;
list<cProjectile> Projectiles;
list<cAsteroid> Asteroids;

And I want my function to work on all of these lists. Is that possible?

Regards
Philip
 




 14 Posts in Topic:
stl::list modified erase
Philip Mueller <me@[EM  2008-03-17 22:52:14 
Re: stl::list modified erase
Christopher <cpisz@[EM  2008-03-17 15:54:22 
Re: stl::list modified erase
Christopher <cpisz@[EM  2008-03-17 16:01:45 
Re: stl::list modified erase
Kai-Uwe Bux <jkherciue  2008-03-17 19:07:21 
Re: stl::list modified erase
Philip Mueller <me@[EM  2008-03-18 00:55:11 
Re: stl::list modified erase
Kai-Uwe Bux <jkherciue  2008-03-17 20:12:46 
Re: stl::list modified erase
Philip Mueller <me@[EM  2008-03-18 11:14:58 
Re: stl::list modified erase
Kai-Uwe Bux <jkherciue  2008-03-18 06:39:38 
Re: stl::list modified erase
Philip Mueller <me@[EM  2008-03-20 01:16:42 
Re: stl::list modified erase
Kai-Uwe Bux <jkherciue  2008-03-19 20:59:42 
Re: stl::list modified erase
Philip Mueller <me@[EM  2008-03-21 12:52:50 
Re: stl::list modified erase
Kai-Uwe Bux <jkherciue  2008-03-21 08:34:44 
Re: stl::list modified erase
"Daniel T." <  2008-03-18 06:51:02 
Re: stl::list modified erase
"Victor Bazarov"  2008-03-18 08:57:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Sep 7 8:20:35 CDT 2008.