ReactOS 0.4.15-dev-5672-gf73ac17
bug.cpp
Go to the documentation of this file.
1#include <set>
2#include <vector>
3#include <iostream>
4#include <boost/timer.hpp>
5#include <boost/lexical_cast.hpp>
6
7struct compare
8{
9 bool operator()(int* x, int* y)
10 { return *x < *y; }
11
12};
13
14int main(int argc, char const* const argv[])
15{
16 std::size_t niters = argc < 2 ? 1000 : boost::lexical_cast<std::size_t>(argv[1]);
17
18 boost::timer t;
19
20 std::vector<int> v;
21 for (int n = 0; n < niters; ++n)
22 {
23 v.insert(v.begin() + v.size()/2, n);
24 }
25
26 std::cout << "vector fill: " << t.elapsed() << std::endl;
27
28 std::multiset<int*,compare> m;
29 for (int n = 0; n < niters; ++n)
30 {
31 m.insert(&v[n]);
32 }
33 std::cout << "map fill 1: " << t.elapsed() << std::endl;
34 for (int n = 0; n < niters; ++n)
35 {
36 m.insert(&v[n]);
37 }
38 std::cout << "map fill 2: " << t.elapsed() << std::endl;
39}
static int argc
Definition: ServiceArgs.c:12
int main()
Definition: test.c:6
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const GLdouble * v
Definition: gl.h:2040
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble t
Definition: gl.h:2047
GLdouble n
Definition: glext.h:7729
const GLfloat * m
Definition: glext.h:10848
#define argv
Definition: mplay32.c:18
Definition: bug.cpp:8
bool operator()(int *x, int *y)
Definition: bug.cpp:9