Advertisement
a20121248

aumentarEspacios

Oct 1st, 2015
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #define INCREMENTO 5
  2. template<typename T>
  3. void aumentarEspacios(T* &arr, int num, int &tam) {
  4.     tam += INCREMENTO;
  5.     T* aux_arr = new T [tam];
  6.     for (int i = 0; i < num; i++)
  7.         aux_arr[i] = arr[i];
  8.     delete[] arr;
  9.     arr = aux_arr;
  10. }
  11. /* Si esta siendo llamado de otro archivo .cpp, no olvidar colocar los tipos particulares que va a recibir, por ejemplo: */
  12. template void aumentarEspacios(int* &arr, int num, int &tam);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement