标签: c++ vector refactoring
对于向量指针,是否有更简洁的方法通过其指针为向量中的元素赋值。例如;
vector<int> *num = new vector<int>(10,0); //gives {0,0,0,0,0,0,0,0,0,0} num->operator[](2) = 5; //gives {0,0,5,0,0,0,0,0,0,0}. IS HORRIBLE CODE! HELP