I have a struct:
struct OutputStore
{
int myINT;
string mySTRING;
}
If I create an array of type OutputStore as follows:
OutputStore *OutputFileData = new OutputStore[100];
then I can address it with:
OutputFileData[5].myINT = 27;
But if I use a vector instead of an array:
vector<OutputStore> *OutputFileData = new vector<OutputStore>(100);
Then I get an '... is not a member of 'std::vector<_Ty>' error if I try:
OutputFileData[5].myINT = 27;
Since you can access a vector via it's index just as you can an array, why does this line not work. I'm just interested to know as it suggests I'm missing some fundamental bit of understanding.
(I changed to a vector as I wanted to push_back as I do not know the size that my data will reach. I've got it to work by using a constructor for the structure and pushing back via that...I just want to understand what is going on here)