os_erase


Erases all matching items from a container.

A helper algorithm for remove() . Erases all occurrences of value from the container c . Unlike remove() , the size of the container decreases by the number of items that are erased.

Library

Helper<ToolKit>

Declaration

#include <ospace/helper/helper.h>

template< class Container, class T >
void os_erase( Container& c, const T& value )
Example <ospace/helper/examples/oerase1.cpp>
#include <iostream>
#include <vector>
#include <ospace/helper/helper.h>

int numbers[ 6 ] = { 1, 2, 3, 1, 2, 3 };

void
main()
  {
  vector< int > v( numbers, numbers + 6 );

  os_erase( v, 1 );

  for ( vector< int >::iterator i = v.begin(); i != v.end(); ++i )
    cout << *i << ` `;
  cout << "\n";
  }

2 3 2 3 2 3

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.