#include #include #include using namespace std; class Afficher { public: template void operator() (T &elem) const { cout << elem << ' '; } }; int main() { list coll; // insérer 18 éléments dans la list for (int i=-9; i<=9; ++i) { coll.push_back(i); } // Afficher les éléments for_each (coll.begin(), coll.end(), Afficher()); cout << endl; return 0; }