1. T *temp_array = new T[cols];
  2. for ( int i=0; i< cols; i++)
  3. {
  4. temp_array[i] = push_vector[i];
  5. }
  6. // temp_array has the values.
  7.  
  8. T *temp_value[rows+1];
  9. for ( int i=0; i< rows; i++)
  10. {
  11. temp_value[i] = values[i];
  12. }
  13. // temp_value has all the pointers that was in values.
  14. temp_value[rows] = temp_array;
  15. // completed.
  16. for ( int i=0; i< cols ; i++)
  17. {
  18. delete values[i];
  19. }
  20. // values deleted. all the dynamic memory deleted.
  21.  
  22. for ( int i=0; i< rows+1; i++)
  23. {
  24. values[i] = temp_value[i];
  25. }
  26. // temp_values added to values.