Sir*_*sto 4 c++ templates decltype string-literals
template<typename T> class X; int main() { X<decltype("")> x; }
为什么G ++演绎T的const char (&)[1],而不是简单const char[1]?
T
const char (&)[1]
const char[1]
Nat*_*ica 7
与其他每个rvalue的文字不同,字符串文字是左值. decltype应用于左值表达式为您提供参考,因此const char (&)[1]是正确的行为.
decltype
归档时间:
6 年,9 月 前
查看次数:
88 次
最近记录: