Skip to content

Add ranges::replace_copy[_if]#2666

Merged
akukanov merged 14 commits intomainfrom
dev/ranges-replace-copy-akukanov
May 7, 2026
Merged

Add ranges::replace_copy[_if]#2666
akukanov merged 14 commits intomainfrom
dev/ranges-replace-copy-akukanov

Conversation

@akukanov
Copy link
Copy Markdown
Contributor

@akukanov akukanov commented Apr 17, 2026

The initial implementation used unary transform underneath, but, as the discussion in comments revealed, that would impose extra requirements on one or more of the data types. The final implementation uses an appropriate "walk" pattern with __replace_copy_functor.

@akukanov akukanov added this to the 2022.13.0 milestone Apr 17, 2026
@akukanov akukanov marked this pull request as ready for review April 17, 2026 17:56
@akukanov akukanov force-pushed the dev/ranges-replace-copy-akukanov branch from 926673f to 805aa7c Compare April 28, 2026 12:12
Comment on lines +35 to +38
test_range_algo<0, int, data_in_out_lim>{big_sz}(dpl_ranges::replace_copy_if, replace_copy_if_checker, pred, -29);
test_range_algo<1, int, data_in_out_lim>{}(dpl_ranges::replace_copy_if, replace_copy_if_checker, pred1, -277, proj);
test_range_algo<2, P2, data_in_out_lim>{}(dpl_ranges::replace_copy_if, replace_copy_if_checker, pred2, -43, &P2::x);
test_range_algo<3, P2, data_in_out_lim>{}(dpl_ranges::replace_copy_if, replace_copy_if_checker, pred3, -817, &P2::proj);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A case with different types of R and OutR is not covered. It's not a blocker, since it is not done in other similar tests nor in the iterator-based tests. We can leave a TODO and create an issue.

Comment thread include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h Outdated
Comment thread include/oneapi/dpl/pstl/utils.h Outdated
@akukanov akukanov force-pushed the dev/ranges-replace-copy-akukanov branch from 4ed22f6 to 99615d4 Compare May 4, 2026 09:49
Copy link
Copy Markdown
Contributor

@danhoeflinger danhoeflinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread include/oneapi/dpl/pstl/utils.h
@akukanov akukanov merged commit 085eaa3 into main May 7, 2026
22 of 23 checks passed
@akukanov akukanov deleted the dev/ranges-replace-copy-akukanov branch May 7, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants