No, it's not. If it were on the stack and you returned from the function the frame of which it would be positioned in, the data would get destructed which is of course not the case.
What is on the stack is probably the local copy of the structure when push_back is called (although I'm not sure as push_back probably takes a const reference and not a copy).
Sheng: Why do you need that array there in the first place? Can't you use a vector that dynamically allocates its data as it is needed?
By the way, if you don't need a vector but a linked list, use QLinkedList and not QVector
Yes, actually I used linked list, just use QVector for the example since all of them crashes.
Bookmarks