I have some class that stores vector. And I have getter for it
class Data{
private:
std::vector<Point*> points;
public:
inline std::vector<Point*> getPoints(){
return points;
}
}
When I call getPoints() will it return temporary object? Or it will just copy it?
Or I should return const reference, instead?
UPDATE
And what if I have another class that hold my Data, which also have a getter:
class Controller{
private:
Data *data;
public:
inline std::vector<Point*> getPoints(){
return data->getPoints();
}
}
Should both of them be const reference, if I want them not to be copied?