Skip to content

Commit 3f95a69

Browse files
committed
[NFC] Add limitations section to doc
1 parent fbcb099 commit 3f95a69

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

clang-tools-extra/docs/clang-tidy/checks/modernize/use-structured-binding.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,37 @@ in a range-based for loop:
5454
The check also supports custom pair-like types via the :option:`PairTypes`
5555
option.
5656

57+
Limitations
58+
-----------
59+
60+
The check currently ignores variables defined with attributes or qualifiers
61+
except const and & since it's not very common:
62+
63+
.. code-block:: c++
64+
65+
static auto pair = getPair();
66+
static int b = pair.first;
67+
static int c = pair.second;
68+
69+
The check doesn't check for some situations which could possibly transfered
70+
to structured bnindings, for example:
71+
72+
.. code-block:: c++
73+
74+
const auto& results = mapping.try_emplace("hello!");
75+
const iterator& it = results.first;
76+
bool succeed = results.second;
77+
// succeed is not changed in the following code
78+
79+
and:
80+
81+
.. code-block:: c++
82+
83+
const auto results = mapping.try_emplace("hello!");
84+
if (results.second) {
85+
handle_inserted(results.first);
86+
}
87+
5788
Options
5889
-------
5990

0 commit comments

Comments
 (0)