Skip to content

PSTL algos in <numeric> need to move the __init variables #118539

@jwakely

Description

@jwakely

All of reduce, transform_reduce, exclusive_scan, and inclusive_scan, transform_exclusive_scan, and transform_inclusive_scan only have a precondition on the type of init that it meets the Cpp17MoveConstructible requirements, so when passing it to the next internal function it needs to be moved, not copied:

     return transform_inclusive_scan(std::forward<_ExecutionPolicy>(__exec), __first, __last, __result, __binary_op,
-                                    __pstl::__internal::__no_op(), __init);
+                                    __pstl::__internal::__no_op(), std::move(__init));

e.g.

return transform_reduce(std::forward<_ExecutionPolicy>(__exec), __first, __last, __init, __binary_op,

Metadata

Metadata

Assignees

No one assigned

    Labels

    pstlIssues related to the C++17 Parallel STL

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions