12345678910111213141516171819202122232425262728293031323334353637 |
- #ifndef TWOBLUECUBES_CATCH_DETAIL_REPEAT_HPP_INCLUDED
- #define TWOBLUECUBES_CATCH_DETAIL_REPEAT_HPP_INCLUDED
- #include <type_traits>
- #include <utility>
- namespace Catch {
- namespace Benchmark {
- namespace Detail {
- template <typename Fun>
- struct repeater {
- void operator()(int k) const {
- for (int i = 0; i < k; ++i) {
- fun();
- }
- }
- Fun fun;
- };
- template <typename Fun>
- repeater<typename std::decay<Fun>::type> repeat(Fun&& fun) {
- return { std::forward<Fun>(fun) };
- }
- }
- }
- }
- #endif
|