c ++ – My implementation of a for_each function that traverses a std :: container by an integer of size not N

I had written this function with the following driver program and output:

#understand 
#understand 
#understand 

// Iteration forward from beginning to end by size N.
model
void for_each_by_n (container && cont, function f, unbound_by unsigned = 1) {
if (increment_by == 0) returns; // must check this without op

using std :: begin;
auto it = begin (cont);

using std :: end;
auto end_it = end (cont);

while (it! = end_it) {
in shape);
for (unsigned n = 0; n <increment_by; ++ n) {
if (it == end_it) return;
++ le;
}
}
}

int main () {
std :: array arr {0,1,2,3,4,5,6,7};
std :: vector with {1.2, 1.5, 1.9, 2.5, 3.3, 3.7, 4.2, 4.8};

auto l = [](auto & v) {std :: cout << v << & # 39 ;; };

for_each_by_n (arr, l); std :: cost << & # 39;  n & # 39;
for_each_by_n (vec, l); std :: cost << & # 39;  n & # 39;

for_each_by_n (arr, l, 2); std :: cost << & # 39;  n & # 39;
for_each_by_n (arr, l, 4); std :: cost << & # 39;  n & # 39;

for_each_by_n (vec, l, 3); std :: cost << & # 39;  n & # 39;
for_each_by_n (vec, l, 5); std :: cost << & # 39;  n & # 39;

for_each_by_n (arr, l, 8); std :: cost << & # 39;  n & # 39;
for_each_by_n (vec, l, 8); std :: cost << & # 39;  n & # 39;

// check the mental health to see if it is not going well.
for_each_by_n (arr, l, 9); std :: cost << & # 39;  n & # 39;
for_each_by_n (vec, l, 9); std :: cost << & # 39;  n & # 39;

returns 0;
}

-Exit-

    0 1 2 3 4 5 6 7
1,2 1,5 1,9 2,5 3,3 3,7 3,7 4,2 4,8
0 2 4 6
0 4
1,2 2,5 4,2
1,2 3,7
0
1.2
0
1.2

While I was giving an answer to this question / answer. I did my best to check for any bugs, corner cases, etc.

What I would like to know about my function above:

  • Does this follow modern C ++ standards?
  • Is there room for improvement?
  • Have I forgotten possible bugs that I may have forgotten?
  • Would this be considered legible, reliable, generic, portable, multiplatform and reusable?
  • Do I have to worry about the accuracy of const, type deduction, cache errors, etc.?
  • -Note-: I know that the function above is not in a designated namespace, it does not concern us here. I can do it without hassle or trouble.

Let me know what you think; I look forward to receiving all your comments.

I would like to know in advance because I am thinking of adding a second unsigned integer parameter to this function. This would allow the user to choose the index location that he wishes to use for his starting position. This parameter as would also have a default value but in this case it would be 0.