bind on member functions of stl containers
Hi,
I would like to accomplish
Code:
#include <tr1/functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
using namespace tr1;
using namespace placeholders;
int main()
{
int ar[] = {0, 1, 2, 3, 4, 5};
vector<int> ivec(ar, ar+6);
set<int> iset(ar, ar+6);
for_each(ivec.begin(), ivec.end(),
bind(&std::set<int>::erase, &iset, _1));
cout << iset.size();
return 0;
}
and I do not see why this piece of code does not compile...