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