Core C++

7. Type systems🔗

Overloading of functions and methods by the type of the arguments, operator members, class templates instantiated by substitution, subtyping and type inference.

A name denotes an overload set, and a call selects one candidate. An infix operator on an object, and the indexing of an object, are the calls of the members operator⊕ and operator[], and a member may return \tau\&, which is what makes v[i] = x work.

A template is expanded before the program is checked, so instantiation costs nothing at run time and a template is never checked, only its instantiations are.

  1. 7.1. Overloading
  2. 7.2. Operator members
  3. 7.3. Parametric polymorphism
  4. 7.4. Subtyping and inference