[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: kdebase/kioslave/smtp
From:       Antonio Larrosa =?utf-8?q?Jim=C3=A9nez?= <larrosa () kde ! org>
Date:       2003-04-26 21:05:44
[Download RAW message or body]

El Sábado, 26 de Abril de 2003 20:16, André Wöbbeking escribió:
> On Saturday 26 April 2003 19:09, Antonio Larrosa Jiménez wrote:
> > Also, the STL has other leaks in other areas different from the
> > documentation too, for example, how do you remove an element from a
> > vector by value ? Or how do you get an iterator that points to an
> > element in the vector which has a specific value ? You have to
> > iterate through all the vector, which is not nice at all (if you know
> > any other way to do it, I'll be glad to hear it :) )
>
> You have to use algorithms, as most thinks in STL are implemented
> generic.
>
> it = std::find(vec.begin(), vec.end(), bla)
>
> vec.erase(it)
>

Hmm, interesting.

> and without find - this looks indeed a bit strange :-)
>
> vec.erase(std::remove(vec.begin(), vec.end(), bla), vec.end())
>

I see. Quite unreadable if you ask me :) but thanks a lot, I'm forced to 
use the STL in other projects and that helps me a lot.

Greetings,

--
Antonio Larrosa Jimenez
KDE developer - larrosa@kde.org
http://developer.kde.org/~larrosa/
Mejor leer algo en inglés que una adivinanza en español.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic