In the old days, we were trained to use result parameters passed by reference to avoid unnecessary data copying.
However, with smarter compilers and specific extensions for C ++ 11, is this still required ?
In particular, is there any reason in 2018 with modern C ++ 11 / C ++ 14 compilers (still) to use
void Filter(vector<CObject*> &elements, vector<CObject*> &outElements);
instead of simply returning a vector, i.e.
vector<CObject*> Filter(vector<CObject*> &elements);
Thank you in advance for your understanding!
source
share