Type Inference: auto and decltype
`auto` deduces a variable's type from its initialiser; `decltype(expr)` gives an expression's type.
Easy
auto it = readings.begin(); — auto drops references and top-level const; use const auto& to avoid copies.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.