Home >Backend Development >C++ >Why Does `decltype((...))` Return a Reference While `decltype(...)` Doesn\'t?
Understanding the Significance of Parentheses in decltype((...))
The use of double parentheses in decltype((...)) has a subtle but important impact on the type deduced by the decltype operator, as evidenced in the example from the C 17 Function Definition Concurrency (FCD).
When applied to an unparenthesized identifier (id-expression) or a class member access expression, decltype returns the type of the referenced entity. However, when the expression is an lvalue (a variable or expression referring to a memory location), decltype prefixes an additional reference (&) before the entity's type.
In the FCD example:
The above is the detailed content of Why Does `decltype((...))` Return a Reference While `decltype(...)` Doesn\'t?. For more information, please follow other related articles on the PHP Chinese website!