My rule of thumb is:
Use pointers if you want to do pointer arithmetic with them (e.g. incrementing the pointer address to step through an array) or if you ever have to pass a NULL-pointer.
Use references otherwise.
Related Contents:
- Pointer vs. Reference
- What are the differences between a pointer variable and a reference variable?
- When to use references vs. pointers
- When should I use the new keyword in C++?
- Why is ‘this’ a pointer and not a reference?
- How to cast/convert pointer to reference in C++
- Passing references to pointers in C++
- What is the difference between std::reference_wrapper and a simple pointer?
- Reason to Pass a Pointer by Reference in C++?
- C++ pass an array by reference
- Meaning of *& and **& in C++
- error: invalid initialization of non-const reference of type ‘int&’ from an rvalue of type ‘int’
- Why are references not reseatable in C++
- C++: difference between ampersand “&” and asterisk “*” in function/method declaration?
- how does the ampersand(&) sign work in c++? [duplicate]
- difference between a pointer and reference parameter?
- Why do some people prefer “T const&” over “const T&”?
- initial value of reference to non-const must be an lvalue
- Difference between pointer to a reference and reference to a pointer
- dereferencing a pointer when passing by reference
- Reference to non-static member function must be called
- Pointer vs Variable speed in C++
- Static global variables in C++
- Difference between const. pointer and reference?
- Pass by pointer & Pass by reference [duplicate]
- Out parameters and pass by reference [closed]
- How are references implemented internally?
- What are the differences between a pointer and a reference in Rust?
- Why doesn’t reference-to-member exist in C++?
- convert reference to pointer representation in C++
- Is it wrong to dereference a pointer to get a reference?
- Does it make sense to combine optional with reference_wrapper?
- Why are pointers to a reference illegal in C++?
- C++ standard: dereferencing NULL pointer to get a reference? [duplicate]
- When should I use pointers instead of references in API-design?
- What is the difference between const int*, const int * const, and int const *?
- Typedef function pointer?
- What is uintptr_t data type
- Is it better in C++ to pass by value or pass by reference-to-const?
- gsl::not_null vs. std::reference_wrapper vs. T&
- C++ Array of pointers: delete or delete []?
- Pointers as keys in map C++ STL
- Do all pointers have the same size in C++?
- How to return a class object by reference in C++?
- How expensive is it to dereference a pointer?
- How can I convert a cv::Mat to a gray scale in OpenCv?
- C++ – Assigning null to a std::string
- Why does int pointer ‘++’ increment by 4 rather than 1?
- Declarations in C++
- What is a void pointer and what is a null pointer?