What are the auto and decltype keywords used for?
Show answer and explanation
auto asks the compiler to deduce a declared type from an initializer using rules largely modeled on template argument deduction; the written declarator still controls references and cv-qualification. decltype(expr) computes a type without evaluating the expression and preserves value-category information, with special rules for unparenthesized names. decltype(auto) applies those decltype rules to a deduced declaration or return type and can therefore preserve references that plain auto would drop.
auto asks the compiler to deduce a declared type from an initializer using rules largely modeled on template argument deduction; the written declarator still controls references and cv-qualification. decltype(expr) computes a type without evaluating the expression and preserves value-category information, with special rules for unparenthesized names. decltype(auto) applies those decltype rules to a deduced declaration or return type and can therefore preserve references that plain auto would drop.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.