File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ namespace clang::tidy::readability {
1919// /
2020// / The emptiness of a container should be checked using the `empty()` method
2121// / instead of the `size()`/`length()` method. It shows clearer intent to use
22- // / `empty()`. Furthermore some containers may implement the `empty()` method
23- // / but not implement the `size ()` or `length()` method. Using `empty ()`
24- // / whenever possible makes it easier to switch to another container in the
25- // / future.
22+ // / `empty()`. Furthermore some containers (for example, a `std::forward_list`)
23+ // / may implement the `empty ()` method but not implement the `size ()` or
24+ // / `length()` method. Using `empty()` whenever possible makes it easier to
25+ // / switch to another container in the future.
2626class ContainerSizeEmptyCheck : public ClangTidyCheck {
2727public:
2828 ContainerSizeEmptyCheck (StringRef Name, ClangTidyContext *Context);
Original file line number Diff line number Diff line change @@ -9,9 +9,10 @@ with a call to ``empty()``.
99
1010The emptiness of a container should be checked using the ``empty() `` method
1111instead of the ``size() ``/``length() `` method. It shows clearer intent to use
12- ``empty() ``. Furthermore some containers may implement the ``empty() `` method
13- but not implement the ``size() `` or ``length() `` method. Using ``empty() ``
14- whenever possible makes it easier to switch to another container in the future.
12+ ``empty() ``. Furthermore some containers (for example, a ``std::forward_list ``)
13+ may implement the ``empty() `` method but not implement the ``size() `` or
14+ ``length() `` method. Using ``empty() `` whenever possible makes it easier to
15+ switch to another container in the future.
1516
1617The check issues warning if a container has ``empty() `` and ``size() `` or
1718``length() `` methods matching following signatures:
You can’t perform that action at this time.
0 commit comments