]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/convert/test/performance.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / convert / test / performance.cpp
index ac20809705fe34f98b0116956b8fb20928583b19..1e954454b81b8239734fbe78a6605bc3d86192b0 100644 (file)
@@ -1,5 +1,5 @@
 // Boost.Convert test and usage example
-// Copyright (c) 2009-2016 Vladimir Batov.
+// Copyright (c) 2009-2020 Vladimir Batov.
 // Use, modification and distribution are subject to the Boost Software License,
 // Version 1.0. See http://www.boost.org/LICENSE_1_0.txt.
 
@@ -16,13 +16,10 @@ int main(int, char const* []) { return 0; }
 #include <boost/convert/strtol.hpp>
 #include <boost/convert/spirit.hpp>
 #include <boost/convert/lexical_cast.hpp>
-#include <boost/detail/lightweight_test.hpp>
 #include <boost/timer/timer.hpp>
-#include <boost/array.hpp>
 #include <boost/random/mersenne_twister.hpp>
 #include <boost/random/uniform_int_distribution.hpp>
-#include <cstdlib>
-#include <cstdio>
+#include <array>
 
 using std::string;
 using boost::convert;
@@ -35,7 +32,7 @@ namespace { namespace local
     template<typename Type>
     struct array
     {
-        typedef boost::array<Type, 20> type;
+        typedef std::array<Type, 20> type;
     };
     template<typename T> static typename array<T>::type const& get();
 
@@ -145,9 +142,9 @@ template<typename Type, typename Converter>
 double
 raw_str_to(Converter const& cnv)
 {
-    local::strings strings = local::get_strs(); // Create strings on the stack
-    int const         size = strings.size();
-    local::timer     timer;
+    auto strings = local::get_strs(); // Create strings on the stack
+    int     size = strings.size();
+    auto   timer = local::timer();
 
     for (int t = 0; t < local::num_cycles; ++t)
         for (int k = 0; k < size; ++k)
@@ -160,9 +157,9 @@ template<typename Type, typename Converter>
 double
 local::str_to(Converter const& try_converter)
 {
-    local::strings strings = local::get_strs(); // Create strings on the stack
-    int const         size = strings.size();
-    local::timer     timer;
+    auto strings = local::get_strs(); // Create strings on the stack
+    int     size = strings.size();
+    auto   timer = local::timer();
 
     for (int t = 0; t < local::num_cycles; ++t)
         for (int k = 0; k < size; ++k)
@@ -175,11 +172,9 @@ template<typename string_type, typename Type, typename Converter>
 double
 local::to_str(Converter const& try_converter)
 {
-    typedef typename local::array<Type>::type collection;
-
-    collection  values = local::get<Type>();
-    int const     size = values.size();
-    local::timer timer;
+    auto values = local::get<Type>();
+    int    size = values.size();
+    auto  timer = local::timer();
 
     for (int t = 0; t < local::num_cycles; ++t)
         for (int k = 0; k < size; ++k)
@@ -211,9 +206,9 @@ template<typename Converter>
 double
 performance_type_to_str(Converter const& try_converter)
 {
-    boost::array<change, 3>   input = {{ change::no, change::up, change::dn }};
-    boost::array<string, 3> results = {{ "no", "up", "dn" }};
-    local::timer              timer;
+    std::array<change, 3>   input = {{ change::no, change::up, change::dn }};
+    std::array<string, 3> results = {{ "no", "up", "dn" }};
+    local::timer            timer;
 
     for (int k = 0; k < local::num_cycles; ++k)
     {