Let's say I have a couple of vectors of integers and a pointer to a vector of integers. How would I go about changing the value of one element of the pointer to be the address in one of the other vectors of integers?
The context for this is that I've built a class that lets me bring in my desktop into the unreal engine, however on each tick it has to assign a form of vector that contains a struct to the values of another data class each tick, I instead wish to copy the memory addresses over for only a few of the elements (the pixel colour values) so I don't waste time by having to do a copy twice (which for a desktop image is millions of operations)
#include <iostream>
#include <vector>
using namespace std;
// Print function
void PrintVector(vector<int> v)
{
 for( int i = 0; i < v.size(); i++ )
 {
 cout << v[i] << ", ";
 }
 cout << endl;
}
int main()
{
    vector<int> vector1;
    vector<int> vector2;
    vector<int> *ptrvector;
    //Do some assignment so the vectors have values
    for( int i = 0; i<3; i++)
    {
        vector1.push_back(i);
        vector2.push_back(2*i);
    }
    //Assign the pointer to the address of vector1.
    ptrvector = &vector1;
    //Print out:
    PrintVector(vector1);  // (1,2,3)
    PrintVector(vector2);  // (2,4,6)
    PrintVector(*ptrvector); // (1,2,3)
    // We should see that lines 1 and 3 are the same
    //BROKEN BIT::
    //Ideally want something like
    ptrvector[0] = &vector2[2];
    PrintVector(*ptrvector); // (6,2,3);
    //Such that if I were to do this:
    vector2[2] = 20;
    PrintVector(*ptrvector); // It should change as a side effect: (20,2,3)
}
BONUS QUESTION:
Let's say I have this:
TArray<FColor> ColorData;
TArray<FColor> *ptrColorData
//Where TArray is essentially a vector. FColor is a struct with members (R,G,B,A)
//ColorData is initialised somewhere and we set the ptrColorData to the address
ptrColorData = &ColorData;
//Somewhere down the line we have a long loop whereby we do
ColorData[i].B = somedata[i];
ColorData[i].G = somedata[i+1];
ColorData[i].R = somedata[i+3];
//somedata is updated per tick, asigning ColorData per tick as well slows it down.
// I wish to be able to do something on the lines of this
ptrColorData[i].B = &somedata[i];
ptrColorData[i].G = &somedata[i+1];
ptrColorData[i].R = &somedata[i+3];
// this is only called once to initialize. Because the memory address
//is unchanging and somedata changes by functions on its own it means when
// I tell my unreal engine to update a texture by passing (*ptrColorData)
// to a function it automatically has the new data when that function is
// next called.
 
    