Early and late binding

“Binding” means associating names with properties. “Function binding” is to associate what function definition is linked with each function call.

Qualifiers

a type qualifier is a keyword that is used to instruct the compiler that the type now qualified is special in some way.

In C++ there are 2 well-known qualifiers: const (including constexpr, etc.) and volatile. “cv-qualifier” is the term used to refer both as a whole.

Variadic functions

Variadic functions are functions that take a variable number of arguments. We can implement such functions using C-style variadic functions or modern C++ variadic templates.

Variadic templates

Template parameters can accept unbounded number of arguments of different types

void print() {} // overload defined as recursion base case when args is empty

template <typename T, typename Types...>
void print(T first_arg, Types... args) { // args is called function param pack
  // do something...
  print(args);
}

// print(2, 3.0, "a") -> print(3.0, "a") -> print("a") -> print() (stop!)

we can also define the recursion base case by declaring print with 1 dependent type only, thanks to resolution rule prioritizing templates without trailing param pack….

Param pack expansion

template <typename Types...>
void print(Types... args) {
  func(args...); // expand to func(arg1, arg2, ..., argN);
}

Fold expression

since C++ 17, fold expression enables computing the result using a binary operator over all arguments in a param pack (with an optional init value!)