clang-tidy - readability-use-std-min-max — Extra Clang Tools 22.1.8 documentation

# Extra Clang Tools 22.1.8 documentation

## clang-tidy - readability-use-std-min-max

# readability-use-std-min-max

Replaces certain conditional statements with equivalent calls to `std::min` or `std::max`. Note: This may impact performance in critical code due to potential additional stores compared to the original if statement.

Before:

    void foo() {
      int a = 2, b = 3;
      if (a < b)
        a = b;
    }

After:

    void foo() {
      int a = 2, b = 3;
      a = std::max(a, b);
    }