7 c++ language-lawyer user-defined-literals
C++ 标准在所有范围内保留以下划线开头后跟大写字母的名称。
这是否适用于用户文字运算符?
例如
int _MyInt; // reserved, violation
template < char... >
auto operator "" _MyInt ( ); // reserved???
Run Code Online (Sandbox Code Playgroud)
不,它允许使用下划线后跟大写字母(否则是保留标识符)。
\n\n\n\n我在支持上述内容的标准中只找到了一个示例,而不是正式的段落:
\n\n\n\ndouble operator""_Bq(long double); // OK: does not use the reserved identifier _\xc2\xadBq\ndouble operator"" _Bq(long double); // uses the reserved identifier _\xc2\xadBq \nRun Code Online (Sandbox Code Playgroud)\n\n因此,只要您不在""和之间添加空格_Ud就可以 - 根据示例。
| 归档时间: |
|
| 查看次数: |
150 次 |
| 最近记录: |