Make all BufferIterators shaped#496
Conversation
e249813 to
1119c6f
Compare
1119c6f to
bb7d78a
Compare
bb7d78a to
98edd17
Compare
5eaf8ba to
e3e2bdd
Compare
|
I asked Gemini to review and this is what it said For (1), I need to think about it. I certainly wouldn't handle the 8dim case, but I am a little tempted to handle the 1D case with a union. Something like union Loc {
std::make_unique<ssize_t[]> multi;
ssize_t flat;
}the code complexity is quite non-trivial though. Needs thought. (2) seems like a no-brainer worth doing For (3) I think it's confused and dereferencing 0d iterators works just fine. Even though it is equal to For (4) I am not sure the performance will be much different, but I'll look into it. I'll also add |
|
After some more reading:
For (4) I don't see any performance difference. That leaves (1) which I think is safe to leave alone for now. So overall we got a few more tests, a missing |
…iterator_category
|
|
||
| #include <array> | ||
| #include <cstdint> | ||
| #include <iostream> |
Work in progressMakes all iterators shaped.
This simplifies the implementation somewhat, and means that all iterators work with
std::default_sentinelwhich is both convenient and faster.The downside of this change is that our
Array::view()method returns astd::range, but not astd::common_range. That means it doesn't play nicely with a lot of the older C++ algorithm methods because the type of the beginning and end iterators are not the same. For example, std::accumulate has this signature:so one cannot do
One should instead do
or
The one that's most annoying is
std::vector::assign_rangeis a C++23 feature.Overall though I think it's worth it.