| 1 |
.. title:: clang-tidy - modernize-type-traits |
| 2 |
|
| 3 |
modernize-type-traits |
| 4 |
===================== |
| 5 |
|
| 6 |
Converts standard library type traits of the form ``traits<...>::type`` and |
| 7 |
``traits<...>::value`` into ``traits_t<...>`` and ``traits_v<...>`` respectively. |
| 8 |
|
| 9 |
For 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 |
|
| 18 |
Would 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 |
|
| 27 |
Options |
| 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`. |