Hello everyone. I began to recently study C++ and ran into the DeclType operator. As far as I know, the operators as well as the functions return a certain value, but reading the documentation on the Microsoft website (https://docs.microsoft.com/ru-ru/cpp/cpp/decltype-cpp?view=msvc-160 ) I saw the next line” decltype type descriptor Returns the type of specified expression. “. As far as I know the type, as a returned value, cannot be returned, but then how does this happen? Thank you in advance, I hope you will help.
Answer 1, Authority 100%
See, for example
int a; ...
I want to declare the variable of the same type as
decltype (a) b;
Roughly – But to understand –
DeclType (a) is replaced by the type with which
A – Decl AreD Type
decltype and has no return value, as this is not a function, but part of the type specifier. In essence, this design is related
* (makes from the type on the left pointer or
& amp; & amp; (makes from the type of RVALUE link). Unlike them,
Delctype makes one type that has an expression in parentheses. In this case, the expression in parentheses is not executed (UNEVALUED CONTEXT).