xref: /llvm-project/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst (revision 376168babb51aa08bc864d4797db4a6dbd53fdbc)
1.. title:: clang-tidy - modernize-type-traits
2
3modernize-type-traits
4=====================
5
6Converts standard library type traits of the form ``traits<...>::type`` and
7``traits<...>::value`` into ``traits_t<...>`` and ``traits_v<...>`` respectively.
8
9For example:
10
11.. code-block:: c++
12
13  std::is_integral<T>::value
14  std::is_same<int, float>::value
15  typename std::add_const<T>::type
16  std::make_signed<unsigned>::type
17
18Would be converted into:
19
20.. code-block:: c++
21
22  std::is_integral_v<T>
23  std::is_same_v<int, float>
24  std::add_const_t<T>
25  std::make_signed_t<unsigned>
26
27Options
28-------
29
30.. option:: IgnoreMacros
31
32  If `true` don't diagnose traits defined in macros.
33
34  Note: Fixes will never be emitted for code inside of macros.
35
36  .. code-block:: c++
37
38    #define IS_SIGNED(T) std::is_signed<T>::value
39
40  Defaults to `false`.
41