-
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
Cxx20standard #1768
base: distributed-ranges
Are you sure you want to change the base?
Cxx20standard #1768
Conversation
@akukanov , @MikeDvorskiy , here is my work in progress regarding making DR working C++-20 standard. |
... maybe alternative is to officially say users to use ranges-v3 with oneDPL::DR if they need lower than 23 standard. This should work out of the box. |
@@ -112,7 +112,7 @@ sort(R&& r, Compare comp = Compare()) | |||
|
|||
T* medians = sycl::malloc_device<T>(n_segments * n_splitters, sp::devices()[0], sp::context()); | |||
|
|||
for (auto&& [segment_id_, segment] : stdrng::views::enumerate(segments)) | |||
for (auto&& [segment_id_, segment] : dr::__detail::make_enumerate(segments)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out that we are using a functional approach for the sake of a functional approach...
I would suggest a little bit re-writing this loop is following way (w/o make_enumerate):
for (auto segment_id = 0, n = stdrng::size(segment); segment_id < n; ++segment_id)
{
auto segment = segments[segment_id ];
.......
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MikeDvorskiy , thanks for looking into this. Looks acceptable, although it is more lines of code.
Are other places with enumarate also easily changeable? Do you think it is more clean than having make_enumerate' or does it fixes some problems which
make_enumerate` has (if it has)?
Enumerate is quite common programming pattern making code shorter and more readable.
I don't object of changing all places where there is enumerate to some code like this if it is needed to add C++20 support. Please feel free to clone my change to your branch and continue adding any changes you think may be good for C++20 support.
I have talked to Mikhail. It sounds like our internal zip_view has some built-in assumptions that complicate its use as a replacement for the standard one. Let's keep this patch as a reference - as I still think there should be our own C++20 zip_view for both "regular" and distributed range algorithms, - but I am fine to postpone resolution of this question for a later update. |
CXX-20 lacks zip_view (used one from oneDPL), enumerate (implemented self simple version).
Anyway still there are some problems and I think I can no longer hold everything else to work on this further.
Any help on this is appreciated.
Currently fails with