Skip to content

Commit c572915

Browse files
committed
Remove reference in for loop
1 parent 8a073f6 commit c572915

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/repeat.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22
#include <iostream>
33

44
int main() {
5+
// Example usage of lz::repeat, yields elements by value
56
const auto to_repeat = 155;
67
const auto amount = 4;
78
const auto repeater_n = lz::repeat(to_repeat, amount);
89
const auto repeater_inf = lz::repeat(to_repeat);
910

1011
#ifdef LZ_HAS_CXX_17
11-
for (int& i : repeater_n) {
12+
for (int i : repeater_n) {
1213
std::cout << i << ' ';
1314
// Or use fmt::print("{} ", i);
1415
}
1516
// Output: 155 155 155 155
1617

17-
for (const auto& i : repeater_inf) {
18+
for (const auto i : repeater_inf) {
1819
std::cout << i << ' ';
1920
// Or use fmt::print("{} ", i);
2021
}

0 commit comments

Comments
 (0)