Are all temporaries rvalues in C++?

前端 未结 7 924
隐瞒了意图╮
隐瞒了意图╮ 2020-12-05 04:56

I have been coding in C++ for past few years. But there is one question that I have not been able to figure out. I want to ask, are all temporaries in C++, rvalues?

7条回答
  •  旧时难觅i
    2020-12-05 05:24

    An array indexing operation is both a temporary and an lvalue, something like a[10] = 1 is an example of what you're looking for; the lvalue is a temporary, calculated pointer.

提交回复
热议问题