-
Notifications
You must be signed in to change notification settings - Fork 117
Perfect forwarding of execution policy in tests #2308
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
Conversation
d51f389
to
93ced22
Compare
2f1f5db
to
49b1713
Compare
5e925f1
to
a899601
Compare
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.
Pull Request Overview
This PR ensures that execution policies are perfectly forwarded in test cases by wrapping algorithm calls with std::forward, and also fixes spelling errors in test comments.
- Perfect forwarding of execution policy parameters has been introduced across various algorithm test calls.
- Spelling mistakes in test comments (e.g., “itertors” to “iterators”) have been corrected.
Reviewed Changes
Copilot reviewed 71 out of 71 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/parallel_api/algorithm/alg.modifying.operations/swap_ranges.pass.cpp | Updated swap_ranges call to use std::forward(exec) |
test/parallel_api/algorithm/alg.modifying.operations/shift_left_right.pass.cpp | Updated shift_left_right call and corrected spelling in comments |
test/parallel_api/algorithm/alg.modifying.operations/rotate_copy.pass.cpp | Updated rotate_copy call to use std::forward(exec) |
test/parallel_api/algorithm/alg.modifying.operations/replace_copy.pass.cpp | Updated replace_copy and replace_copy_if calls with std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/replace.pass.cpp | Updated replace and replace_if calls with std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/remove_copy.pass.cpp | Updated remove_copy call to use std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/remove.pass.cpp | Updated remove and remove_if calls with std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/generate.pass.cpp | Updated generate and generate_n calls with std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/fill.pass.cpp | Updated fill call with std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/copy_move.pass.cpp | Updated copy, copy_n, and move calls with std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp | Updated reverse_copy call with std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/alg.reverse/reverse.pass.cpp | Updated reverse call with std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp | Updated stable_partition call with std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp | Updated partition_copy call with std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/alg.partitions/partition.pass.cpp | Updated partition call with std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp | Updated is_partitioned call with std::forward forwarding |
test/parallel_api/algorithm/alg.modifying.operations/alg.copy/copy_if.pass.cpp | Updated copy_if and remove_copy_if calls with std::forward forwarding |
test/parallel_api/algorithm/alg.merge/merge.pass.cpp | Updated merge calls with std::forward forwarding |
test/parallel_api/algorithm/alg.merge/inplace_merge.pass.cpp | Updated inplace_merge calls with std::forward forwarding |
test/general/test_policies.pass.cpp | Updated test_policy_instance call to use std::forward forwarding in fill |
Comments suppressed due to low confidence (2)
test/parallel_api/algorithm/alg.modifying.operations/swap_ranges.pass.cpp:105
- [nitpick] In this file the execution policy is forwarded using std::forward(exec), while in several other test files the template parameter is named 'Policy'. Consider unifying the naming of the execution policy type across all tests for improved clarity.
Iterator2 actual_return = swap_ranges(std::forward<ExecutionPolicy>(exec), data_b, data_e, actual_b);
test/parallel_api/algorithm/alg.modifying.operations/shift_left_right.pass.cpp:64
- [nitpick] Here the execution policy is forwarded as std::forward(exec). Consider aligning the template parameter name with other tests (e.g., using either 'Policy' or 'ExecutionPolicy' consistently) to avoid potential confusion.
It res = algo(::std::forward<Policy>(exec), first, ::std::next(first, m), n);
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.
LGTM.
I've checked that introduced std::forward
are used with forwarding references, and that they are not used multiple times for the same object.
I haven't checked if all possible places are covered, but I trust Sergey here given the scope and coverage of the PR.
This PR updates test cases to perfectly forward execution policies using
std::forward
and fixes spelling mistakes in comments.std::forward<Policy>(exec)
(orExecutionPolicy
) in various algorithm test calls to preserve value category.