with the const correctness chapter of the C++ FAQ in mind, i think about redesigning my getters.
I have the following code example:
Is it genereally more appropriate to return by const reference or by value?
// prefer this one?
T getter1(const int index) const
// or this one by const ref?
T const &getter2(const int index) const
As much as i know, a reference can never be NULL, so if my data might be NULL in any point in the data array, i should rather return by value. Is this the only criteria to choose between the two?