On Sun, Feb 06, 2005 at 12:05:01PM +0100, Lars Gullik Bjønnes wrote:
> | It sort of is, but the criterion how many items are erased is given by
> | the inset argument.
> 
> But would be much clearer to use something like
> 
> cur.erase(cur.begin() + i, cur.end());

*shrug* If this makes the code more clear to tou, use this one.
I was not even aware that someone might object to use resize 
to shrink a vector...

> using resize for this almost count as obfuscation.
> I think it could even be written like
> 
> cur.erase(find_if(cur.begin(), cur.end(), findInset(in)), cur.end());
> 
> i.e.
> 
>         iterator it = find_if(cur.begin(), cur.end(), findInset(in));
>         if (it != cur.end())
>                cur.erase(it, cur.end);
 
Change it if you don't like it.

Andre'

Reply via email to