template struct value_category { // Or can be an integral or enum value static constexpr auto value = "prvalue"; }; template struct value_category { static constexpr auto value = "lvalue"; }; template struct value_category { static constexpr auto value = "xvalue"; }; // Double parens for ensuring we inspect an expression, // not an entity #define VALUE_CATEGORY(expr) value_category::value int main() { int x; cout << VALUE_CATEGORY(x) << endl; // prints lvalue cout << VALUE_CATEGORY(move(x)) << endl; // prints xvalue cout << VALUE_CATEGORY(42) << endl; // prints prvalue }