Lets say I have structure that looks like below -
struct Member
{
Membe(char* member1In, char* member2In)
{
strcpy(member1, member1In);
strcpy(member2, member2In);
}
char member1[10];
char member2[10];
};
and std::vector declared as
std::vector<Member> members{};
And I insert values using emplace_back()
like below
members.emplace_back(value1, value2);
So my question is when array grows beyond capacity, it has to move to some other location. Who will allocate memory for Member structure ? Do I have to write my own copy, assignment and move operations or compiler provided are enough ? Will default provided operation do shallow copy and create problem ?
Aucun commentaire:
Enregistrer un commentaire