xref: /llvm-project/clang-tools-extra/docs/clang-tidy/checks/hicpp/ignored-remove-result.rst (revision 3ed940ac3dac03d044a8d1e51005cec84dd128f9)
1.. title:: clang-tidy - hicpp-ignored-remove-result
2
3hicpp-ignored-remove-result
4===========================
5
6Ensure that the result of ``std::remove``, ``std::remove_if`` and ``std::unique``
7are not ignored according to
8`rule 17.5.1 <https://www.perforce.com/resources/qac/high-integrity-cpp-coding-standard/standard-library>`_.
9
10The mutating algorithms ``std::remove``, ``std::remove_if`` and both overloads
11of ``std::unique`` operate by swapping or moving elements of the range they are
12operating over. On completion, they return an iterator to the last valid
13element. In the majority of cases the correct behavior is to use this result as
14the first operand in a call to ``std::erase``.
15
16This check is a subset of :doc:`bugprone-unused-return-value <../bugprone/unused-return-value>`
17and depending on used options it can be superfluous to enable both checks.
18
19Options
20-------
21
22.. option:: AllowCastToVoid
23
24   Controls whether casting return values to ``void`` is permitted. Default: `true`.
25