clang 格式破坏 C++ 用户定义的文字 _$

问题描述 投票:0回答:0

在以下代码上应用 clang-format 时:

int operator"" _€(unsigned long long  amount) { return amount; }
int operator"" _$(unsigned long long  amount) { return amount; }


int main()
{
    auto euros = 1_€ ;
    auto dollars = 2_$;
    
    return 0;
}

我在 $:

上多了一个空间
    auto euros = 1_€; // Ok
    auto dollars = 2_ $; // This does not compile!!!

我该如何解决这个问题?

c++ c++20 clang-format
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.