clang-tools-extra/docs/clang-tidy/checks/modernize/shrink-to-fit.rst
raw| 1 | .. title:: clang-tidy - modernize-shrink-to-fit |
| 2 | |
| 3 | modernize-shrink-to-fit |
| 4 | ======================= |
| 5 | |
| 6 | |
| 7 | Replace copy and swap tricks on shrinkable containers with the |
| 8 | ``shrink_to_fit()`` method call. |
| 9 | |
| 10 | The ``shrink_to_fit()`` method is more readable and more effective than |
| 11 | the copy and swap trick to reduce the capacity of a shrinkable container. |
| 12 | Note that, the ``shrink_to_fit()`` method is only available in C++11 and up. |