2

可能重复:
为什么字符串文字是左值,而所有其他文字都是右值?

什么是移动语义?出现以下代码片段和注释:

void some_function(std::string&& r);

some_function("hello world");

评论:

在上面的例子中,“hello world”是一个 const char[12] 类型的左值。

为什么硬编码常量"hello world"是 const char[12] 类型的左值,而不是 const char[12] 类型的右值

4

0 回答 0