C++ 标准在所有范围内保留以下划线开头后跟大写字母的名称。
这是否适用于用户文字运算符?
例如
int _MyInt; // reserved, violation
template < char... >
auto operator "" _MyInt ( ); // reserved???
最佳答案
不,它允许使用下划线后跟大写字母(否则为保留标识符)。
Source
在支持上述内容的标准中,我只找到了一个示例,而不是正式段落:
[over.literal]
double operator""_Bq(long double); // OK: does not use the reserved identifier _Bq
double operator"" _Bq(long double); // uses the reserved identifier _Bq
所以,只要你不在
""
之间加空格和 _Ud
没关系 - 根据这个例子。
关于c++ - 保留名称和用户文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62179658/