[PATCH] [Clang Tidy]: Use shrink_to_fit instead of copy and swap trick.
xazax.hun at gmail.com
Wed Jan 21 03:35:03 PST 2015
The \c shrink_to_fit() method is more readable and more effective than
the copy and swap trick to reduce the capacity of a shrinkable container.
Note that, the \c shrink_to_fit() method is only available in C++11 and up.
std::vector<int>(v).swap(v); will be replaced with v.shrink_to_fit();
There was already a checker which targeted C++11, however it did not contain any check, which standard is used during the analysis. Maybe a check should be added to suppress C++11 specific warnings when clang tidy is invoked in C++03 mode?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7545 bytes
Desc: not available
More information about the cfe-commits