Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:02:47

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
0008 // Adapted from donated nonius code.
0009 
0010 #ifndef CATCH_REPEAT_HPP_INCLUDED
0011 #define CATCH_REPEAT_HPP_INCLUDED
0012 
0013 #include <type_traits>
0014 #include <catch2/internal/catch_move_and_forward.hpp>
0015 
0016 namespace Catch {
0017     namespace Benchmark {
0018         namespace Detail {
0019             template <typename Fun>
0020             struct repeater {
0021                 void operator()(int k) const {
0022                     for (int i = 0; i < k; ++i) {
0023                         fun();
0024                     }
0025                 }
0026                 Fun fun;
0027             };
0028             template <typename Fun>
0029             repeater<std::decay_t<Fun>> repeat(Fun&& fun) {
0030                 return { CATCH_FORWARD(fun) };
0031             }
0032         } // namespace Detail
0033     } // namespace Benchmark
0034 } // namespace Catch
0035 
0036 #endif // CATCH_REPEAT_HPP_INCLUDED