Closed wolfv closed 7 years ago
@wolfv thanks for opening this. I agree that there is room for another xview
-like xexpression that would take a vector of such variants.
Similarly, all expressions have two access operators ()
which takes a compile-time known number of argument and []
which takes a single multi-index of dynamic size....
Since std::variant
is a C++17 only feature, we will probably need to polyfill it in xtensor.
The newaxis
functionality might be easier to implement in the case of dynamic xviews.
Just FYI i prototyped something here: https://github.com/wolfv/xtensor/tree/xdynview (https://github.com/wolfv/xtensor/blob/xdynview/include/xtensor/xdynview.hpp)
Implemented in #269.
Currently xview is implemented using tuple as holder for the slices. As far as I understand this necessitates that all slices are known at compile time. .....
But for example when creating a view from python, it's not possible to know the slices at compile time. It would also make writing the xreducer functionality easier (as e.dimension() is not a constexpr and cannot be used as template parameter etc.) (or that's at least how I tried doing it).
So I am wondering whether it would be a good idea to either create a separate, dynamic xview class or exchange the tuple in xview for a std::vector holding an std::variant<xall, xrange, size_t> or similar.