Avatar ·

What are rvalues, lvalues, xvalues, glvalues and prvalues in C++?

I started learning C++11 and came across the terms "lvalue" and "rvalue", but then I saw that there are more: xvalue, glvalue, prvalue. I'm confused. \n\nIn old C++ I understood that an lvalue is what stands on the left side of an assignment (e.g., a variable), and an rvalue is on the right side (e.g., the number 5). But in C++11, move semantics and std::move appeared, and now I don't understand which category the expression std::move(x) belongs to. Is it an lvalue or an rvalue? And why do people talk about "value categories"? \n\nHere's an example that confuses me:\n```cpp\nint x = 10; // x - lvalue\nint y = x + 5; // x+5 - rvalue\nint&& z = std::move(x); // What is std::move(x)?\n```\nI've heard there are 5 categories: lvalue, rvalue, xvalue, glvalue, prvalue. Can you explain them in simple terms with examples? And how are they related to move semantics?