C++ 当有换行符时,clang格式会在if条件下删除缩进
我有这个功能:C++ 当有换行符时,clang格式会在if条件下删除缩进,c++,clang-format,C++,Clang Format,我有这个功能: bool WS::receive(MB *const buffer) const { updateLastPackage(); if ((!lastPackage_.empty()) && (lastPackage_.size() <= buffer->capacity()) && (lastUpdate_.getTime() <= settings_.refresh
bool WS::receive(MB *const buffer) const {
updateLastPackage();
if ((!lastPackage_.empty()) &&
(lastPackage_.size() <= buffer->capacity()) &&
(lastUpdate_.getTime() <= settings_.refreshPeriod)) {
buffer->clear();
(*buffer) << lastPackage_;
return true;
}
return false;
}
bool WS::receive(MB*常量缓冲区)常量{
updateLastPackage();
如果((!lastPackage_uu.empty())&&
(lastPackage.size()容量()&&
(lastUpdate.getTime()清除();
(*buffer)感谢Yksisarvinen
解决方案:
AlignOperands: false
ContinuationIndentWidth: 8
它似乎被AlignOperators覆盖,但要实际添加一些缩进,您需要修改ContinuationIndentWidth,这可能会更改代码的其他部分。您的意思是删除if
条件中的缩进,而不是函数参数吗?@cigien是的,对不起,我的错误
AlignOperands: false
ContinuationIndentWidth: 8