Empirically determine value category of C++11 expression?

后端 未结 2 940
夕颜
夕颜 2020-11-29 03:51

Each expression in C++11 has a value category. One of lvalue, xvalue or prvalue.

Is there a way to write a macro that, given any expression as an argument, will pro

2条回答
  •  半阙折子戏
    2020-11-29 04:38

    You could also try using the clang API's Classification function to return the category of the expression from a clang AST containing the expression. This is, of course, far more complex than @Luc's solution, since it requires generating the actual AST through clang.

提交回复
热议问题