Advertisement
a20121248

memoriaExacta

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