| 1 |
.. title:: clang-tidy - modernize-concat-nested-namespaces |
| 2 |
|
| 3 |
modernize-concat-nested-namespaces |
| 4 |
================================== |
| 5 |
|
| 6 |
Checks for use of nested namespaces such as ``namespace a { namespace b { ... } }`` |
| 7 |
and suggests changing to the more concise syntax introduced in C++17: ``namespace a::b { ... }``. |
| 8 |
Inline namespaces are not modified. |
| 9 |
|
| 10 |
For example: |
| 11 |
|
| 12 |
.. code-block:: c++ |
| 13 |
|
| 14 |
namespace n1 { |
| 15 |
namespace n2 { |
| 16 |
void t(); |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
namespace n3 { |
| 21 |
namespace n4 { |
| 22 |
namespace n5 { |
| 23 |
void t(); |
| 24 |
} |
| 25 |
} |
| 26 |
namespace n6 { |
| 27 |
namespace n7 { |
| 28 |
void t(); |
| 29 |
} |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
Will be modified to: |
| 34 |
|
| 35 |
.. code-block:: c++ |
| 36 |
|
| 37 |
namespace n1::n2 { |
| 38 |
void t(); |
| 39 |
} |
| 40 |
|
| 41 |
namespace n3 { |
| 42 |
namespace n4::n5 { |
| 43 |
void t(); |
| 44 |
} |
| 45 |
namespace n6::n7 { |
| 46 |
void t(); |
| 47 |
} |
| 48 |
} |
| 49 |
|