However, when I print out the values stored by the pointer vector, the first 2 values are not the same as what the input was. I have tried it with 4 - 10 values and always, the first 2 are not the same as the input but the rest are. I tried printing out the values as they are stored in the vector in the first for-loop and it seems to contain them all, but after that first for-loop, when I try to print *station.front(), it is now changed to something else.
I'd keep it simple, anytime you need a pointer to the element in 'i_vec', just pass the element by reference (&). But I don't actually know what you're trying to do so this might not be an option.
I don't know if what I am trying to do is possible, but I want to make a way for all the values in the station vector to have a pointer to each other, so that when I increment the value of one of the elements, it will also increment the value it is pointing to and in turn that one increments the next and so on... this is to replace the use of for-loops to iterate through the elements and increment them one at a time. So when I print out the numbers in the line vector, they are all updated to the new values
so that when I increment the value of one of the elements, it will also increment the value it is pointing to and in turn that one increments the next and so on
Sounds a little misguided, and also not possible with pointers. Incrementing a pointer means the pointer is no longer pointing at the original object. You could use a reference wrapper to approximate it, but I really don't see the point of the misdirection. It's more efficient and straightforward to iterate through the original vector and increment each element.
It does the same thing but if you just don't like the look of for loops then this is a solution. Just keep in mind, assuming no compiler optimization this is technically slower because you're pushing and popping the stack for each element in the array. Also you'll have to dereference your elements when you increment them the way you described above.