2 ms·
Normally decltype(E) returns the type of the expression E. The type of the expressions *&value and value are both int& for instance. However they also wanted a
by edflsafoiewq 3y ago
Normally decltype(E) returns the type of the expression E. The type of the expressions *&value and value are both int& for instance. However they also wanted a way to query the type an identifier was declared with, eg int x would be int. For some reason they chose to expose this by overriding decltype(E) when E is a plain identifier. decltype((value)) avoids this special case and returns the type of the expression (value), which is obviously the same as the expression value.