Warning, /sdk/clazy/docs/checks/README-temporary-iterator.md is written in an unsupported language. File is not indexed.

0001 # temporary-iterator
0002 
0003 Detects when you're using functions returning iterators (eg. `begin()` or `end()`) on a temporary container.
0004 
0005 #### Example
0006 
0007     // temporary list returned by function
0008     QList<type> getList()
0009     {
0010         QList<type> list;
0011         ... add some items to list ...
0012         return list;
0013     }
0014 
0015     // Will cause a crash if iterated using:
0016 
0017     for (QList<type>::iterator it = getList().begin(); it != getList().end(); ++it)
0018     {
0019       ...
0020     }
0021 
0022 because the end iterator was returned from a different container object than the begin iterator.