Type Inference

suggest change

Versions

Introduction

This topic discusses type inference with the keyword auto, available since C++11.

Remarks

Add const, &, or constexpr to an auto declaration when the program needs those properties; doing so can prevent unintended copies or mutation. Use auto when the initializer makes the type clear or when spelling the type would add noise, while avoiding it where an explicit type better communicates intent.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents