Wednesday, May 16, 2007

Pointers and references

A reference can be seen as a dereferenced const pointer and a const reference is similar to a dereferenced const pointer to const. You should use pointers as arguments or return values where you can not use a reference (ownership transfer, pointer arithmetics). In every other case you should prefer a reference.