Debian Codegraph @

llvm-project/clang-tools-extra/docs/clang-tidy/checks/abseil/cleanup-ctad.rst

raw
1 .. title:: clang-tidy - abseil-cleanup-ctad
2
3 abseil-cleanup-ctad
4 ===================
5
6 Suggests switching the initialization pattern of ``absl::Cleanup``
7 instances from the factory function to class template argument
8 deduction (CTAD), in C++17 and higher.
9
10 .. code-block:: c++
11
12 auto c1 = absl::MakeCleanup([] {});
13
14 const auto c2 = absl::MakeCleanup(std::function<void()>([] {}));
15
16 becomes
17
18 .. code-block:: c++
19
20 absl::Cleanup c1 = [] {};
21
22 const absl::Cleanup c2 = std::function<void()>([] {});