Hi Guys,
I have a struct of int's which I am trying to initialise by pushing and popping a vector of integers.
All is working well if I initialise manually from the vector (for example)
options.vsync = boolQuery(optionsList.back(), mem);
optionsList.pop_back();
Instead of doing this for every member I am trying to use a simple 'for loop'. (Ignore the name boolQuery - this actually returns an int 0 for false, 1 for true, and -1 for indeterminate).
for (int i = 0; i < optionsList.size(); i++)
{
int value = boolQuery(optionsList.back(), mem);
optionsList.pop_back();
memcpy(&options + (i * sizeof(int)), &value, sizeof(int));
}
This works for the first member but the remainder stay uninitialised.
Debugging shows that the expected values are occurring during the loop, but they just aren't getting stored in the member integers.
It looks as though the way I am trying to access the memory for the memcpy seems to be wrong.
Any advice would be hugely appreciated.