Debian Codegraph @

clang-tools-extra/docs/clang-tidy/checks/readability/container-data-pointer.rst

raw
1 .. title:: clang-tidy - readability-container-data-pointer
2
3 readability-container-data-pointer
4 ==================================
5
6 Finds cases where code could use ``data()`` rather than the address of the
7 element at index 0 in a container. This pattern is commonly used to materialize
8 a pointer to the backing data of a container. ``std::vector`` and
9 ``std::string`` provide a ``data()`` accessor to retrieve the data pointer which
10 should be preferred.
11
12 This also ensures that in the case that the container is empty, the data pointer
13 access does not perform an errant memory access.
14
15 Options
16 -------
17
18 .. option:: IgnoredContainers
19
20 Semicolon-separated list of containers regexp for which this check won't be
21 enforced. Default is `empty`.