是否有办法配置clang-format使嵌套的命名空间声明保持在同一行
Is there a way to configure clang-format to keep nested namespace declarations on the same line?
在我工作的代码库中,我们总是这样声明嵌套的命名空间:
namespace foo { namespace detail {
// stuff
} } // foo::detail namespace
我还没有找到一种方法来配置clang-format
not将其分解成多行:
namespace foo {
namespace detail {
// stuff
}
} // foo::detail namespace
我尝试了BreakBeforeBraces
配置,并研究了clang 3.8中的新BraceWrapping
配置,但都没有成功。
是否可以这样做,而不注释代码与// clang-format [on/off]
?
原来这是clang-format团队考虑过的特性,但被拒绝了。更多详细信息,请参见https://llvm.org/bugs/show_bug.cgi?id=17928。
clang-format 6.0有"CompactNamespaces: true"选项,这正是您所要求的。见http://clang.llvm.org/docs/ClangFormatStyleOptions.html
相关文章:
- .cpp和.h文件中的模板专用化声明
- 未在作用域中声明unordered_map
- C++避免重复声明的语法是什么
- 用c++从输入文件中读取另一行
- 读取文件的最后一行并输入到链接列表时出错
- 如何确保C++函数在定义之前声明(如override关键字)
- 错误:未在此范围内声明'reverse'
- 我正在使用嵌套的while循环来解析具有多行的文本文件,但由于某种原因,它只通过第一行,我不知道为什么
- 奇怪的(对我来说)返回声明 - 在谷歌上找不到任何关于它的信息
- 为什么在定义函数之前先声明它
- 如何声明一个数组,然后在另一行中赋值
- 在一行中声明并初始化指针到类实例
- 将在一行中声明的成员记录在一起,而不创建组
- C++函数声明行的哪些部分位于定义的第一行
- 如果在一行中声明两个对象,则按什么顺序构造它们
- C++在同一行声明指针和数组合法吗
- 是否有办法配置clang-format使嵌套的命名空间声明保持在同一行
- 在C++中,你能在同一行声明多个引用变量吗
- 在一行中声明和实现纯虚析构函数
- C++在同一行中声明多个变量