I have a class with a std::vector data member e.g.
class foo{ public: const std::vector getVec(){return myVec;} //other stuff omitted private: s
The problem is that you always return another copy of the vector. Use a reference:
const std::vector& getVec(){return myVec;} //other stuff omitted