Reputation: 5073
Let's consider very short piece of code in C++:
class T{
};
T *t = new T();
What is type of *t
? rvalue/lvalue/xvalue/glvalue? why?
Thanks in advance.
Upvotes: 0
Views: 58
Reputation: 206717
The check for lvalue is very simple. Can it appear on the left hand side of an assignment operator?
In your case, the answer is "yes".
*t = T();
is valid. Hence, the value of type of *t
is lvalue.
By virtue of being an lvalue, it is also a glvalue.
From https://timsong-cpp.github.io/cppwp/n3337/basic.lval:
A glvalue (“generalized” lvalue) is an lvalue or an xvalue.
Upvotes: 1