c++ - Qtvector content modification not happening -


i have struct functionstruct , qvector<functionstruct> . doing following.. when click on button slot calls function.

when click 1st time prints "somedoc" (expected) when click 2nd time (and onwards) prints nothing ( member null)

int s = 0;  void foo() {     if(!s) {         functionstruct *newp = new functionstruct;         functionstruct old = function_list.at(0);         newp->function_string.append(old.function_string);         newp->start = old.start;         newp->function_doc = "somedoc";         function_list.replace(0,*newp);         s = 1;     }     qdebug() << "pd0 contents " << function_list.at(0).function_doc  } 


Comments