Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. if (myCapacity == 0)
  2. {
  3. myArray = new ObjectType[aNewCapacity];
  4. myCapacity = aNewCapacity;
  5. return;
  6. }
  7.  
  8. ObjectType *tempArray = myArray;
  9.  
  10. myArray = new ObjectType[aNewCapacity];
  11.  
  12. if (mySafeModeFlag == false)
  13. {
  14. memcpy(tempArray, myArray, sizeof(ObjectType) * ((myCapacity < aNewCapacity) ? myCapacity : aNewCapacity));
  15. }
  16. else
  17. {
  18. for (SizeType i = 0; i < ((mySize < aNewCapacity) ? mySize : aNewCapacity); i++)
  19. {
  20. myArray[i] = tempArray[i];
  21. }
  22. }
  23. myCapacity = aNewCapacity;
  24.  
  25. delete tempArray;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement