Does it make sense to use std :: forward with the typeid operator?
From [expr.typeid] / 3:
When
typeid
applied to an expression other than the glvalue of the polymorphic class type, the result refers to an objectstd::type_info
that represents the static type of the expression.
In the C ++ standard, "expression type" is never a reference type; The "referential" (lvalue or rvalue) of an expression is expressed in its value category. Since it std::forward
does not change the type of the expression, only its value category (for example, from lvalue to rvalue), when applied std::forward
, will not affect the result typeid
.
source to share