Skip to content

Readability check to suggest replacement of conditional statement with std::min/std::max #64914

Closed
@EugeneZelenko

Description

@EugeneZelenko

It'll be great to add a readability check to suggest the replacement of conditional statements with std::min/std::max. For example:

if (value1 < value2)
  value1 = value2; // value1 = std::max(value1, value2);
if (value2 < value1)
  value1 = value2; // value1 = std::min(value1, value2);

value2 may be expression, number, etc.

See also PyLint's consider-using-min-builtin and consider-using-max-builtin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions