+ 3
do i need to overload the = operator?
first of all, I'm just experimenting... I have a pointer, pointing to a private vector member std::vector< double > *vPtr = &vec_; void setVec(double &s,double &t,double &u,double &v) { vPtr[0] = s; vPtr[1] = t; vPtr[2] = u; vPtr[3] = v; };
3 odpowiedzi
+ 1
or would it be better to say
class_type *cPtr = NULL;
"...
private:
std::vector<other_class_type> vec_;
..."
+ 1
any way you do it. its not a problem.
the 1st one is what most people do in the industry
0
I wouldn't worry about memory allocation for vectors,its automatic..Your compiler will throw a couple errors......