array
array copied to clipboard
Need a version of generate() that takes indices
generate() works like std::generate() and needs to maintain state elsewhere. It'd be nice to have a function that does a fill based on "pattern function" that takes in indices instead:
Equivalent to something like:
for_each_index(image.shape(), [&](const typename Shape::index_type& i) {
image(i) = std::apply(pattern, i);
});
I don't have any good names though. fill() is already taken. fill_with_pattern? What's the dual of enumerate?
We might be able to just overload fill?
Implemented in #69 as transform_index and transform_indices.