Questions tagged «rvalue»

2
为什么这里的枚举变量是右值?
例: typedef enum Color { RED, GREEN, BLUE } Color; void func(unsigned int& num) { num++; } int main() { Color clr = RED; func(clr); return 0; } 编译时出现以下错误: <source>: In function 'int main()': <source>:16:9: error: cannot bind non-const lvalue reference of type 'unsigned int&' to an rvalue of type …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.