|
-
May 31st, 2009, 08:19 AM
#5
Re: Program crashes when assigning a string.
 Originally Posted by laserlight
Good catch, especially since Card is not a POD type so the memcpy() is suspect.
Right. The memcpy() invokes undefined behaviour, since Card is non-POD.
Ishida, you cannot use memcpy() on an array of Card objects. The Card object contains a std::string, therefore the only way to copy is to use the proper copy construction and assignment.
That's why "pakk" should either be a vector<Card> or vector<Card*>, more than likely a vector<Card*> due to the BITMAP* member in the Card class.
Regards,
Paul McKenzie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|