+ 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; };

22nd Nov 2018, 4:08 AM
Brandon Autry
Brandon Autry - avatar
3 Answers
+ 1
or would it be better to say class_type *cPtr = NULL; "... private: std::vector<other_class_type> vec_; ..."
22nd Nov 2018, 4:36 AM
Brandon Autry
Brandon Autry - avatar
+ 1
any way you do it. its not a problem. the 1st one is what most people do in the industry
1st Dec 2018, 5:34 AM
San Bhujel
San Bhujel - avatar
0
I wouldn't worry about memory allocation for vectors,its automatic..Your compiler will throw a couple errors......
22nd Nov 2018, 5:03 AM
Mensch
Mensch - avatar