Skip to content

[clang-tidy] feature request: modernize-use-range should include swap #146086

@justusranvier

Description

@justusranvier

Part of modernizing a project to use ranges includes replacing uses of std::swap or instances of the "std 2-step" pattern with calls to std::ranges::swap.

Example:

std::swap(a, b);

or

using std::swap;
swap(a, b);

can both be replaced with:

std::ranges::swap(a, b);

In the latter case an unqualified call to swap should only be flagged if using std::swap; is present in the same scope before the call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-tidyenhancementImproving things as opposed to bug fixing, e.g. new or missing feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions