我尝试编写,const char TabArray[32]{'\t'};因为我想将最多 32 个字节的选项卡传递到函数中(不需要 null),并且编写\t32 次= "\t\t会使我的源代码看起来很丑
如果我想要它 const 我还有其他选择吗?
立即调用 lambda 来救援:
constexpr auto tabs = []{std::array<char, 32> ret; ret.fill('\t'); return ret;}();
Run Code Online (Sandbox Code Playgroud)