ns/releases/3.04/source/stlport/test/eh/bug.cpp
tankefugl 19b458f8bc Branched for 3.0.4 balance
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@141 67975925-1194-0748-b3d5-c16f83f1a3a1
2005-05-29 10:59:29 +00:00

39 lines
908 B
C++

#include <set>
#include <vector>
#include <iostream>
#include <boost/timer.hpp>
#include <boost/lexical_cast.hpp>
struct compare
{
bool operator()(int* x, int* y)
{ return *x < *y; }
};
int main(int argc, char const* const argv[])
{
std::size_t niters = argc < 2 ? 1000 : boost::lexical_cast<std::size_t>(argv[1]);
boost::timer t;
std::vector<int> v;
for (int n = 0; n < niters; ++n)
{
v.insert(v.begin() + v.size()/2, n);
}
std::cout << "vector fill: " << t.elapsed() << std::endl;
std::multiset<int*,compare> m;
for (int n = 0; n < niters; ++n)
{
m.insert(&v[n]);
}
std::cout << "map fill 1: " << t.elapsed() << std::endl;
for (int n = 0; n < niters; ++n)
{
m.insert(&v[n]);
}
std::cout << "map fill 2: " << t.elapsed() << std::endl;
}