Warning, /sdk/clazy/docs/checks/README-strict-iterators.md is written in an unsupported language. File is not indexed.
0001 # strict-iterators 0002 0003 Warns when `iterator` objects are implicitly cast to `const_iterator`. 0004 This is mostly equivalent to passing -DQT_STRICT_ITERATORS to the compiler. 0005 This prevents detachments but also caches subtle bugs such as: 0006 0007 QHash<int, int> wrong; 0008 if (wrong.find(1) == wrong.cend()) { 0009 qDebug() << "Not found"; 0010 } else { 0011 qDebug() << "Found"; // find() detached the container before cend() was called, so it prints "Found" 0012 } 0013 0014 QHash<int, int> right; 0015 if (right.constFind(1) == right.cend()) { 0016 qDebug() << "Not found"; // This is correct now ! 0017 } else { 0018 qDebug() << "Found"; 0019 }