| 1 |
.. title:: clang-tidy - readability-simplify-subscript-expr |
| 2 |
|
| 3 |
readability-simplify-subscript-expr |
| 4 |
=================================== |
| 5 |
|
| 6 |
This check simplifies subscript expressions. Currently this covers calling |
| 7 |
``.data()`` and immediately doing an array subscript operation to obtain a |
| 8 |
single element, in which case simply calling ``operator[]`` suffice. |
| 9 |
|
| 10 |
Examples: |
| 11 |
|
| 12 |
.. code-block:: c++ |
| 13 |
|
| 14 |
std::string s = ...; |
| 15 |
char c = s.data()[i]; // char c = s[i]; |
| 16 |
|
| 17 |
Options |
| 18 |
------- |
| 19 |
|
| 20 |
.. option:: Types |
| 21 |
|
| 22 |
The list of type(s) that triggers this check. Default is |
| 23 |
`::std::basic_string;::std::basic_string_view;::std::vector;::std::array` |