[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 5 00:42:07 PDT 2024
================
@@ -0,0 +1,24 @@
+.. title:: clang-tidy - modernize-use-ranges
+
+modernize-use-ranges
+====================
+
+Detects calls to standard library iterator algorithms that could be replaced
+with a ranges version instead
+
+Example
+-------
+
+.. code-block:: c++
+
+ auto Iter1 = std::find(Items.begin(), Items.end(), 0);
+ auto AreSame = std::equal(std::execution::par, Items1.cbegin(), Items1.cend(),
+ std::begin(Items2), std::end(Items2));
+
+
+transforms to:
+
+.. code-block:: c++
+
+ auto Iter1 = std::ranges::find(Items, 0);
+ auto AreSame = std::equal(std::execution::par, Items1, Items2);
----------------
PiotrZSL wrote:
should be "std::ranges::equal"
https://github.com/llvm/llvm-project/pull/97764
More information about the cfe-commits
mailing list