STL issues
std::list<int> n;
for( std::list<int>::iterator i = n.begin(); i != n.end(); ++i )
{
if ( 0 > *i )
{
n.erase( i );
}
}
for( std::list<int>::iterator i = n.begin(); i != n.end(); )
{
std::list<int>::iterator curr = i++;
if ( 0 > *curr )
{
n.erase( curr );
}
}
const int N = 1000;
vector<int> v;
for(int i = 0; i < N; ++i)
{
v.push_back( i );
}
vector<int> v;
v.reserve( N );
for(int i = 0; i < N; ++i)
{
v.push_back( i );
}
for(int i = 0; i < N-10; ++i)
{
v.pop_back();
}
vector<int>( v ).swap( v );
string s;
string( s ).swap( s );
vector<bool> v;
bool* p = &v[0];
Container<T> c;
...
Container<T>::reverse_iterator ri = ...
c.erase( --ri.base() );
c.erase( (--ri).base() );
copy( istreambuf_iterator<char>( cin ),
istreambuf_iterator<char>(),
ostreambuf_iterator<char>( cout ) );
template <typename FwdIterator, typename Predicate>
FwdIterator remove_if( FwdIterator begin,
FwdIterator end,
Predicate p )
{
begin = find_if( begin, end, p );
if ( begin == end ) return begin;
else
{
FwdIterator next = begin;
return remove_copy_if( ++next, end, begin, p );
}
}
vector<int> vi;
for( int i = 0; i < 10; ++i ) vi.puch_back(i);
remove( vi.begin(), vi.end(), 5);
vector<int>::iterator i = remove( vi.begin(), vi.end(), 5);
vi.erase(i,vi.end());
list<int> li;
li.remove(5);
vector<int>::iterator i = vi.unique( vi.begin(), vi.end() );