I currently have a weird problem with a program segfaulting but im not able to spot the error. I think the problem boils down to this.
struct S {int a; vector<sometype> b;}
S s1;
// fill stuff into a and b
S* s2 = new S();
*s2 = s1;
Could it be that the final copying is illegal in s开发者_运维知识库ome way? Im really confused right now... Thanks
You will get this behaviour if sometype
has a bug in its user defined copy constructor and/or assignment operator. The code you have supplied is perfectly legal.
Sorry, the code looks just fine to me, unless something evil is hidden under 'sometype'
精彩评论