【C++】template 統合スレ -- STL/Boost/Loki, etc.
■ このスレッドは過去ログ倉庫に格納されています
0537デフォルトの名無しさん
NGNGint main()
{
std::vector<A*> a;
std::vector<int> b;
const int maxi = 100000;
for (int i = 0; i < maxi; i++)
if (std::rand() % 2)
a.push_back(new A);
else
a.push_back(new B);
std::transform(a.begin(), a.end(), std::back_inserter(b), std::mem_fun(&A::func));
int i;
i = std::accumulate(b.begin(), b.end(), 0);
std::cout << i << std::endl;
}
■ このスレッドは過去ログ倉庫に格納されています