2011-04-01から1ヶ月間の記事一覧

[C/C++] オブジェクトのnew/deleteにともなうvectorへの自動追加/削除

#include <iostream> #include <vector> #include <algorithm> using namespace std; class A; class A_cmp { public: A_cmp(A *a) { this->a = a; } bool operator()(A *obj) const { return obj == a; } A *a; }; class A { public: A(int n) { cout << "created " << this << " " << n <</algorithm></vector></iostream>…