#include
#include
#include
#include
using namespace std;
template
void print(T& c){
for( typename T::iterator i = c.begin(); i != c.end(); i++ ){
std::cout << *i << endl;
}
}
template
OutputIterator copy_if( InputIterator start, InputIterator stop,OutputIterator out, Predicate select ){
while( start != stop ){
if( select( *start ) )
*out++ = *start;
++start;
}
return out;
}
int main( )
{
const int numbers = 7;
const int num[numbers] = { 5, 0, 3, 2, 1, 4, 7 };
vector v1( num, num+numbers );
print( v1 );
vector v2;
copy_if( v1.begin(), v1.end(), back_inserter( v2 ),bind2nd( less(), 10 ) );
print( v2 );
}