ReactOS  0.4.14-dev-49-gfb4591c
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 
7 struct compare
8 {
9  bool operator()(int* x, int* y)
10  { return *x < *y; }
11 
12 };
13 
14 int 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 }
Definition: bug.cpp:7
static int argc
Definition: ServiceArgs.c:12
int main(int argc, char const *const argv[])
Definition: bug.cpp:14
GLdouble n
Definition: glext.h:7729
GLdouble GLdouble t
Definition: gl.h:2047
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define argv
Definition: mplay32.c:18
const GLfloat * m
Definition: glext.h:10848
#define cout
Definition: iostream.cpp:38
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
Definition: _ostream.h:357
__kernel_size_t size_t
Definition: linux.h:237
bool operator()(int *x, int *y)
Definition: bug.cpp:9
const GLdouble * v
Definition: gl.h:2040
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548