Skip to content

Use `auto` for type inference

Overly explicit typing can distract from what is happening. With auto, the focus shifts to the logic itself.

// Without auto: explicit type for iterator in std::find
std::vector<int>::const_iterator it = std::find(vec.begin(), vec.end(), 42);
// With auto: type inference removes distraction
auto it = std::find(vec.begin(), vec.end(), 42);