I have a problem inserting elements into a pointer to a vector of some elements I defined in my code (in this case Recipes). In some other parts of the code, using push_back seems to work fine, but if I use it in this code:
{
Recipe defaultRec;
this->recipes_ = new vector<Recipe>;
this->recipes_->push_back(defaultRec);
}
I get the following error message:
"Unhandled exception at 0x01164031 in Assignment 2.exe: 0xC0000005: Access violation reading location 0xcccccce0"
The declaration of recipes_ is:
vector<Recipe>* recipes_;
Hope anyone can help me, thanks in advance.