So, I have a vector that is either full of integers. Lets call this vector Vect
. I have my code in main.cpp
and VectorList.h
, and cannot change that fact. In VectorList.h
one of my functions is:
void insertAtFront( const int & );
Now where I'm encountering trouble, I know I can add the integer to the start of the vector using std::vector.insert()
function. But, insertAtFront
does not have access to the vector itself, however, this is the only data member in VectorList.h
:
vector< int > *vList
So, my question is how can I add a value to the beginning of a vector Vect
using only this pointer *vList
?
My first idea was something like this:
&vList.insert(&vList.begin(), 1, &value) // with value being the input integer
but that doesn't work :/ any suggestions?