>     std::vector<int> vec; // your vector of integers
>
>     bool SmallerThan5( int value )
>     {
>         return (value<5);
>     }
>
>     // fill vector
>
>     // Remove elements satisfying predicate SmallerThan5 and
>     // use 'erase' to change(/update) the sequence size.
>     vec.erase( remove_if(vec.begin(),vec.end(),SmallerThan5),
> vec.end() );

And to use Boost.Lambda to reduce everything to one line, you will use:

vec.erase( remove_if( vec.begin(), vec.end(), *_1 < 5 ) );

<disclaimer>Code not tested; but I bet it works!</disclaimer>

-------------
Ehsan Akhgari

Farda Technology (http://www.farda-tech.com/)

List Owner: [EMAIL PROTECTED]

[ Email: [EMAIL PROTECTED] ]
[ WWW: http://www.beginthread.com/Ehsan ]

Physician, heal thyself: then you will also heal your patient. Let it be his
best cure to see with his eyes the man who heals himself.
-Thus Spoke Zarathustra, F. W. Nietzsche




_______________________________________________
msvc mailing list
[EMAIL PROTECTED]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription 
changes, and list archive.

Reply via email to