J'aimerais utiliser des algorithmes de sur un conteneur de pointeurs.

Y a-t-il un adaptateur pour ça?

Exemple:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
 
using namespace std;
 
int main( )
{
	int val1 = 172;
	int val2 = 168;
	int val3 = 0;
	int val4 = 1;
 
	vector<int*> vpi;
	vpi.push_back(&val1);
	vpi.push_back(&val2);
	vpi.push_back(&val3);
	vpi.push_back(&val4);
 
	copy(vpi.begin(), vpi.end(), ostream_iterator<int*>(cout, " "));
	cout << endl;
 
	vpi.erase(remove_if(vpi.begin(), vpi.end(), bind2nd(equal_to<int*>(), &val2)));
 
	copy(vpi.begin(), vpi.end(), ostream_iterator<int*>(cout, " "));
	cout << endl;
 
	return 0;
}
Au lieu de travailler sur les pointeurs, je veux travailler sur les objets pointés (ici un simple int)