Is
auto x = initializer;
equivalent to
decltype(initializer) x = initializer;
or
decltype((initializer)) x = initializer;
or neither?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
decltypealso considers whether the expression isrvalueorlvalue.Wikipedia says,
That pretty much explains the imporant difference. Notice
decltype(c)anddecltype((c))are not same!And sometime
autoanddecltypeworks together in a cooperative way, such as in the following example (taken from wiki, and modified a bit):Wikipedia further explains the semantics of
decltypeas follows: