• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. title:: clang-tidy - readability-uniqueptr-delete-release
2
3readability-uniqueptr-delete-release
4====================================
5
6Replace ``delete <unique_ptr>.release()`` with ``<unique_ptr> = nullptr``.
7The latter is shorter, simpler and does not require use of raw pointer APIs.
8
9.. code-block:: c++
10
11  std::unique_ptr<int> P;
12  delete P.release();
13
14  // becomes
15
16  std::unique_ptr<int> P;
17  P = nullptr;
18