Skip to content

Using std::for_each with a lambda to push_back inefficient #2825

@christophfroehlich

Description

@christophfroehlich

Using std::for_each with a lambda to push_back is less efficient than directly constructing the vector. Consider replacing with cpus.assign(cpu_affinity_param_array.begin(), cpu_affinity_param_array.end()); or using the range constructor.

          cpus.assign(cpu_affinity_param_array.begin(), cpu_affinity_param_array.end());

Originally posted by @Copilot in #2823 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions