Reference
Applies to: cpp
A C++ reference (&) is an alias for an existing variable, set once and never null. Passing by const T&
avoids copying a large object while promising not to modify it, the idiomatic way to pass things you only read.
void scale(std::vector<double>& v, double k); // by reference: no copy, can modify
double norm(const std::vector<double>& v); // const ref: no copy, read-only