For loop with a post-increment of a lazy operator
| 112 | |
| 113 | // For loop with a post-increment of a lazy operator |
| 114 | void lazy_postinc(benchmark::State& state) { |
| 115 | auto source = generate_junk(kSize); |
| 116 | std::vector<int> target(kSize); |
| 117 | auto lazy_range = internal::MakeLazyRange( |
| 118 | [&source](int64_t index) { return source[index]; }, source.size()); |
| 119 | |
| 120 | for (auto _ : state) { |
| 121 | auto lazy_iter = lazy_range.begin(); |
| 122 | auto lazy_end = lazy_range.end(); |
| 123 | auto target_iter = target.begin(); |
| 124 | |
| 125 | while (lazy_iter != lazy_end) *(target_iter++) = *(lazy_iter++); |
| 126 | } |
| 127 | state.SetItemsProcessed(state.iterations() * kSize); |
| 128 | } |
| 129 | |
| 130 | BENCHMARK(lazy_postinc); |
| 131 |
nothing calls this directly
no test coverage detected