cppcheck/samples/erase/out.txt

25 lines
1.2 KiB
Plaintext
Raw Normal View History

2019-08-18 12:51:32 +02:00
samples\erase\bad.cpp:9:32: error: Using iterator to local container 'items' that may be invalid. [invalidContainer]
for (iter = items.begin(); iter != items.end(); ++iter) {
^
samples\erase\bad.cpp:9:17: note: Iterator to container is created here.
for (iter = items.begin(); iter != items.end(); ++iter) {
^
samples\erase\bad.cpp:10:19: note: Assuming condition is true.
if (*iter == 2) {
^
samples\erase\bad.cpp:10:19: note: Assuming condition is true.
if (*iter == 2) {
^
samples\erase\bad.cpp:9:37: note: Assuming condition is true.
for (iter = items.begin(); iter != items.end(); ++iter) {
^
samples\erase\bad.cpp:11:13: note: After calling 'erase', iterators or references to the container's data may be invalid .
items.erase(iter);
^
samples\erase\bad.cpp:4:22: note: Variable created here.
std::vector<int> items;
^
samples\erase\bad.cpp:9:32: note: Using iterator to local container 'items' that may be invalid.
for (iter = items.begin(); iter != items.end(); ++iter) {
^