[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 30 10:14:23 PDT 2024


================
@@ -0,0 +1,26 @@
+.. title:: clang-tidy - modernize-min-max-use-initializer-list
+
+modernize-min-max-use-initializer-list
+======================================
+
+Replaces nested ``std::min`` and ``std::max`` calls with an initializer list where applicable.
+
+For instance, consider the following code:
+
+.. code-block:: cpp
+
+   int a = std::max(std::max(i, j), k);
+
+`modernize-min-max-use-initializer-list` check will transform the above code to:
----------------
5chmidti wrote:

Add `The` to the start of this sentence, maybe drop the check name.

https://github.com/llvm/llvm-project/pull/85572


More information about the cfe-commits mailing list