Simplified user iterators

This commit is contained in:
Robert Maynard
2022-09-01 16:18:08 -04:00
parent c2bfc99f12
commit 910b5cc759
7 changed files with 50 additions and 55 deletions

View File

@@ -116,18 +116,14 @@ struct under_diag final : nvbench::user_axis_space
// our update function
auto diag_under =
[&, info](std::size_t,
std::vector<nvbench::detail::axis_index> &indices) {
nvbench::detail::axis_index temp = info[0];
temp.index = x_pos;
indices.push_back(std::move(temp));
temp = info[1];
temp.index = y_pos;
indices.push_back(std::move(temp));
std::vector<nvbench::detail::axis_index>::iterator start,
std::vector<nvbench::detail::axis_index>::iterator end) {
start->index = x_pos;
end->index = y_pos;
};
const size_t iteration_length = ((info[0].size * (info[1].size + 1)) / 2);
return nvbench::detail::axis_space_iterator(2,
return nvbench::detail::axis_space_iterator(info,
iteration_length,
adv_func,
diag_under);
@@ -188,14 +184,14 @@ struct gauss final : nvbench::user_axis_space
}
// our update function
auto gauss_func = [=](std::size_t index,
std::vector<nvbench::detail::axis_index> &indices) {
nvbench::detail::axis_index temp = info[0];
temp.index = gauss_indices[index];
indices.push_back(std::move(temp));
};
auto gauss_func =
[=](std::size_t index,
std::vector<nvbench::detail::axis_index>::iterator start,
std::vector<nvbench::detail::axis_index>::iterator) {
start->index = gauss_indices[index];
};
return nvbench::detail::axis_space_iterator(1,
return nvbench::detail::axis_space_iterator(info,
iteration_length,
gauss_func);
}