llvm-project/clang-tools-extra/docs/clang-tidy
Adrian Vogelsgesang 3696c70e67 [clang-tidy] Add `readability-container-contains` check
This commit introduces a new check `readability-container-contains` which finds
usages of `container.count()` and `container.find() != container.end()` and
instead recommends the `container.contains()` method introduced in C++20.

For containers which permit multiple entries per key (`multimap`, `multiset`,
...), `contains` is more efficient than `count` because `count` has to do
unnecessary additional work.

While this this performance difference does not exist for containers with only
a single entry per key (`map`, `unordered_map`, ...), `contains` still conveys
the intent better.

Reviewed By: xazax.hun, whisperity

Differential Revision: http://reviews.llvm.org/D112646
2022-01-24 12:57:18 +01:00
..
checks [clang-tidy] Add `readability-container-contains` check 2022-01-24 12:57:18 +01:00
Contributing.rst [clang-tidy] Tidy up spelling, grammar, and inconsistencies in documentation (NFC) 2021-10-23 00:07:36 -07:00
Integrations.rst [Branch-Rename] Fix some links 2021-02-01 16:43:21 +05:30
index.rst Add missing clang-tidy args in index.rst (NFC) 2021-11-22 22:50:05 +13:00