-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove owning_view #1757
base: distributed-ranges
Are you sure you want to change the base?
Remove owning_view #1757
Conversation
91789d4
to
84aa166
Compare
23ce634
to
e732a08
Compare
Both DR tests timed out on "Zip/0.Drop" on this change. It needs to be checked if code does not hang now in this case. |
I will take a look at the test. Yet, I would like to have some pros & cons discussion as well, as I might easily miss some reasons for |
Sure. I have to look and @BenBrock too. It would be great to simplify the code and remove not needed parts. I had no enough time to rereview owning-view so I only managed to spot this failing test. |
The issue here is that we have some functions that create views of segments. They take in a range of segments and return a modified view of those segments (e.g. These functions are implemented, naturally, using standard range adaptors like I assume this is what's causing problems in the PR---we assume that My preference would probably be to simplify using |
Ben's response gave me the clue for where to look. Apparently, the implementation of The semantical questions remain though - what should users expect from |
@BenBrock @lslusarczyk - this patch proposes to completely remove the custom implementation of
owning_view
.For the context, that implementation is used as the return type for
views::zip::segments()
- it wraps a vector of views paired with a rank that the function builds. No other use ofowning_view
exists in the proposed oneDPL patch, but in the standalone DR repo it is also used for the same purpose bydistributed_dense_matrix::segments()
.A comment in
detail/owning_view.hpp
says that the custom implementation ofowning_view
there is needed only for ranges-v3. However, when I tried to replace it tostd::ranges::owning_view
, it resulted in compilation errors, for example (many details omitted):The error happens because
std::ranges::owning_view
is not copyable: see https://en.cppreference.com/w/cpp/ranges/owning_view#ctor. Therefore an lvalue ofowning_view
is not aviewable_range
(see the above log) and cannot be used as an argument to constructstd::views::all
as well as other views (as far as I can see, most views rely onall
at least for CTAD).The custom implementation of
owning_view
in DR does not delete the copy constructor and therefore has no such problem, but consequently it is not compliant to the standard definition ofowning_view
.So, if the custom
owning_view
in DR is replaced with the standard one, then storing the result ofranges::segments()
into a variable and then building a view over that variable (as in the test code below) does not work:However it is not quite clear to me why
views::zip::segments()
wrap the vector it builds intoowning_view
before returning. I guess the idea could have been thatranges::segments()
applied to a view must return a view as well. or maybe you wantedranges::segments()
to be directly used in a view pipe. As far as I can tell, however, the methodsegments()
of your distributed containers returns a copy of their vector of segments. So, unless I miss something, returning a vector of segments without wrapping it intoowning_view
should seemingly be just fine.