Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenbug.cpp
Go to the documentation of this file.
00001 #include <set> 00002 #include <vector> 00003 #include <iostream> 00004 #include <boost/timer.hpp> 00005 #include <boost/lexical_cast.hpp> 00006 00007 struct compare 00008 { 00009 bool operator()(int* x, int* y) 00010 { return *x < *y; } 00011 00012 }; 00013 00014 int main(int argc, char const* const argv[]) 00015 { 00016 std::size_t niters = argc < 2 ? 1000 : boost::lexical_cast<std::size_t>(argv[1]); 00017 00018 boost::timer t; 00019 00020 std::vector<int> v; 00021 for (int n = 0; n < niters; ++n) 00022 { 00023 v.insert(v.begin() + v.size()/2, n); 00024 } 00025 00026 std::cout << "vector fill: " << t.elapsed() << std::endl; 00027 00028 std::multiset<int*,compare> m; 00029 for (int n = 0; n < niters; ++n) 00030 { 00031 m.insert(&v[n]); 00032 } 00033 std::cout << "map fill 1: " << t.elapsed() << std::endl; 00034 for (int n = 0; n < niters; ++n) 00035 { 00036 m.insert(&v[n]); 00037 } 00038 std::cout << "map fill 2: " << t.elapsed() << std::endl; 00039 } Generated on Sun May 27 2012 04:35:14 for ReactOS by
1.7.6.1
|